next avaliable range

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 )
 
B

Bernie Deitrick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top