Ask Experts Questions for FREE Help !
Ask
    fbg3's Avatar
    fbg3 Posts: 1, Reputation: 1
    New Member
     
    #1

    Nov 13, 2009, 01:27 PM
    Macro in an if statement
    I have a large list of names that I need to separate by inserting a new row after each client. How can I build a macro into an if statement and/or a vlookup?
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    Nov 14, 2009, 11:04 AM

    You can't. And you can't make physical changes to your layout with a formula either, only with a macro.

    If all you want to do is go down one column and add a blank row between every existing row of data, this macro will do it. It uses column A.

    Code:
    Sub InsertRows()
    'JBeaucaire  (11/14/2009)
    Dim LR As Long, i As Long
    Application.ScreenUpdating = False
    LR = Range("A" & Rows.Count).End(xlUp).Row
    
        For i = LR To 2 Step -1
            Rows(i).Insert xlShiftDown
        Next i
    
    Application.ScreenUpdating = True
    End Sub

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Multiple-step income statement in good form and retained earnings statement [ 1 Answers ]

Hi I would like someone to check to see if I did this correctly, if I did not then please help. Thanks The Problem is: The following pretax amounts pertain to River Corp. for the year ended December 31, 2008. Sales... $400,000 Operating Expenses... 84,000 Extraordinary gain... 30,000...

If statement macro [ 10 Answers ]

Hello , I have an excel macro to take data from one spreadsheet and format in a partciular method. Now I want to add an if statement like I have an excel formula that works but I need it put into the macro. The formula is: if(AA21="USD", "6YB", "6YA") Help Thanks

If statement in excel macro not working correctly [ 1 Answers ]

I tried to insert the following code into an Excel macro If Range("m1") = "" Then MsgBox ("Number of Units is blank") End If I am doing something wrong, because I get the msgbox whether cell m1 is empty or not. Can anyone help me with the correct syntax?

What is the correct financial statement-statement of cash flows wording? [ 2 Answers ]

Cash (used) in operating activities <10,000> Cash (used) in investing activities 10,000 Thank you for any help you can provide.


View more questions Search