#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Help

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Help

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

-----Original Message-----
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
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Help

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
-----Original Message-----
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

-----Original Message-----
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
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Help

You could use something like

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


On Wed, 28 Jul 2004 20:26:33 -0700, "Tony"
wrote:

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
-----Original Message-----
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

-----Original Message-----
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
.

.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"