next avaliable range

  • Thread starter Thread starter GUS
  • Start date Start date
G

GUS

I want to export some values from one sheet to another , but i want to put
them exactly in specified ranges .
For that , i have predefine 8 ranges at sheet 2
range1, (from celll a1 to a14)
range2,(from cell b1 to b14)
range3 (from cell a15 to a30)
range 4 (from cell b15 to b30)
range 5 (from cell a31 to a45)
etc.

I want to find which range is empty in order to put in it the values from
sheet1.

(the macro which takes the values from sheet1 and paste it to sheet2 is
ready except the above part )
 
GUS,

Sub Macro1()
Dim i As Integer
For i = 1 To 2
If IsEmpty(Worksheets("Sheet2").Range("range" & i).Cells(1, 1).Value)
Then
MsgBox "range" & i & " is empty, so I'll paste it there."
'Do your paste using Worksheets("Sheet2").Range("range" & i)
Exit Sub
End If
Next i
End Sub

HTH,
Bernie
MS Excel MVP
 
Back
Top