Hi, my first post here - so bear with me
I'm pulling across data from another worksheet in my workbook & pasting it into a blank worksheet. In order to ensure my copied data is placed in a blank / fresh area of my new worksheet, i'm looping through my newly pasted data to find the last cell.
When i've found my last cell, i need to insert a couple of blank lines before i paste my next lot of data. Can anyone tell me how to do this in VBa? (i seem to be going wrong with 'selection.insert shift :=xldown'
Here's my current code
[VBA]
Sub testing2()
Dim dumbo As String
Dim i As Integer
'the value to be auto-implanted into the next empty cell
dumbo = "this cell's been populated with the value of a variable"
'loop the formula
For i = 0 To 1
'keep going on errors
On Error Resume Next
'use the range within B column to check against & find the last sell, then select it
Range("rangeb").Cells.SpecialCells(xlCellTypeBlanks).Cells(1).Select '= "put any text in here"
'if we encounter an error, display a message
If Err.Number > 0 Then
MsgBox "all cells are used"
Err.Clear
End If
On Error GoTo 0
'activate the selected blank cell
Selection.Activate
'populate the selection with the valie of the dumbo variable
Selection.Value = dumbo
'do the next loop
Next i
Selection.insert Shift:=xlDown
End Sub
[/VBA]
Thanks & Regards
Russ