ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help (https://www.excelbanter.com/excel-programming/305337-help.html)

Tony

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

Frank Stone

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
.


Tony

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
.

.


Myrna Larson

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
.

.




All times are GMT +1. The time now is 02:23 AM.

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