ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   next avaliable range (https://www.excelbanter.com/excel-programming/280967-next-avaliable-range.html)

GUS

next avaliable range
 
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 )



Bernie Deitrick[_2_]

next avaliable range
 
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

"GUS" wrote in message
...
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 )






All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com