Solved

transform getformula in its value

Posted on 2012-03-09
3
170 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
  • 2
3 Comments
 
LVL 41

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 41

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now