• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Use Cell Input In Macro

ashfire

New Member
I need to insert a number of rows into a worksheet. I cannot copy and paste as thier is information on the worksheet that cannot be removed. The number changes on each worksheet and Id prefer not to use Named Ranges because of this. The code below works but i would like to take the number 5 (in this instance) from a cell (J4).


Tried multiple ways but cant seem to do, what im guessing is a pretty basic thing

Thanks in advance for any help


Sub InsertRows()


Dim RowNum As Integer

Dim InsertNum As Integer


InsertNum = 5

RowNum = 1


Do While RowNum <= InsertNum


Rows("7:7").Select

Selection.Insert Shift:=xlDown


RowNum = RowNum + 1

Loop


End Sub
 
Cheers Hui, after posting i went away and it hit me. seems all i needed to do was ask.....

now i know its not Murpheys Law so ill log that one down to Sods Law.


thanks :D
 
Back
Top