Help

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hi,

How to check that the last row of range(A1:H22)from
sheet1 of "name1.xls" is empty(contains no data)? The
content of shet1 from "name1.xls" will then copy and paste
to a new sheet1 in a new workbbok called "Book1.xls".
Next, the data in sheet2 that belongs to "name1.xls" will
be copied and paste right below the content that is
alreeady pasted earlier to the sheet1 that belongs
to "Book1.xls".

Thanks a million.

regards,
Tony
 
Sub tranferdata()
Sheets("sheet3").Select 'assuming you name1.xls open
Range("H22").Select ' here i am assuming that all cells in
'the range have data
If IsEmpty(Selection) Then
MsgBox ("Range A1:H22 in not full.")
Else
Workbooks.Add 'assuming you want the macro to create
'the new workbook
Windows("name1").Activate
Range("A1:H22").Copy
Windows("book1").Activate 'rename book1 when done(file
'save as)
Range("a1").PasteSpecial xlPasteAll
Windows("name1").Activate
Sheets("Sheet2").Select
Range("A1").Select 'you didn't say where the data was
' or how much
Selection.CurrentRegion.Copy
Windows("book1").Activate
Range("A1").End(xlDown).Offset(1, 0).PasteSpecial
xlPasteAll

End If
MsgBox ("Done")
End Sub
 
hI,

Can it be check that eg Column A from A1: A38 that any of
the cell is empty instead assuming all cells fill up?

regards,
Tony
 
You could use something like

N = Application.COUNTBLANK(Range("A1:A38"))
 

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

Back
Top