Solved

transform getformula in its value

Posted on 2012-03-09
3
184 Views
Last Modified: 2012-03-09
I have the following code

    Dim Ecell As Range
    
    For Each Ecell In Range("B4:B100")
            If IsEmpty(Ecell) Then
    
    Range("U8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("V8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("W8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("X8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("Y8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("Z8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("AA8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("AB8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("AC8").Select
    ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
    Range("AC8").Select
            
    Next Ecell

Open in new window


I would like to execute it for each blank row I find and not only for row 8
0
Comment
Question by:fitaliano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 37703900
for each blank row (in its entirety) or blank cells in each row?


Dave
0
 

Author Comment

by:fitaliano
ID: 37703922
Blank Cell.

F
0
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 37703932
Ok

Try this:

Sub test()
Dim Ecell As Range
Dim rng As Range
Dim r As Range

    For Each Ecell In Range("B4:B100")
        If Trim(Ecell.Value) = vbNullString Then
            For Each r In Range("U" & Ecell.Row, "AC" & Ecell.Row)
                If Trim(r.Value) = vbNullString Then
                    r.FormulaR1C1 = "=SUBTOTAL(9,R[-4]C:R[-1]C)+RC[-1]"
                End If
            Next r
        End If
    Next Ecell
    
            
End Sub

Open in new window


If you post a sample I could confirm, but looks like it worked with the simple sample I created.

Dave
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question