I am going to give this one more try.
I am having some difficulty with determining the line of code that will allow me to insert a new row above the currently selected cell. The code created when you record a macro and do this manually will not work when transported to VBScript.
Here is a snippet of code, with the offending line bolded in red.
oWS.Selection.EntireRow.Insert
Try this on a simple sheet with any data in cell A1 and in A5 and the rest empty.
Desperately wanting an approach!!!
I am having some difficulty with determining the line of code that will allow me to insert a new row above the currently selected cell. The code created when you record a macro and do this manually will not work when transported to VBScript.
Here is a snippet of code, with the offending line bolded in red.
Code:
Set oEx = GetObject("","Excel.Application")
oEx.Visible = true
oEx.Workbooks.open "C:\test.xls"
Set oWS = oEx.ActiveWorkbook.Sheets("Sheet1")
oWS.Activate
Toprow = 1
Bottomrow = 8
For i = Toprow to Bottomrow
oWS.Range("a1").Offset(i,0).Select
If oWS.Range("a1").Offset(i+1,0) <> "" Then
Code:
oWS.Range("a1").Offset(i,0).Select
End If
oWS.Range("a1").Offset(i,0) = "Stuff" & i
oWS.Range("a1").Offset(i,1) = "More Stuff" & i
Next
Try this on a simple sheet with any data in cell A1 and in A5 and the rest empty.
Desperately wanting an approach!!!