![]() |
Macro to create a list
I have a workbook containing a worksheet called €śList€ť and many worksheet
templates. I need a macro to select cells A1:H100 on any of the worksheet templates, copy all data within this range but only if A1:A100 is not blank, and then paste the data on the worksheet called €śList€ť. Ill use a button to activate the macro on each individual worksheet template. When the user activates the macro on the first template, the data will be copied and pasted to the €śList€ť starting at cell A1. When the user activates the macro on any of the subsequent templates, the data will copied and pasted on the €ślist€ť starting at the next empty row in column A. In other words, I want the user to be able to add data to the list from any of the templates. I dont have much experience with vba therefore, any help for a novice to apply this would be greatly appreciated. Thanks in advance, Tom |
Macro to create a list
Try this. Post back if you need more. HTH Otto
Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest End With End If End Sub "tomhelle" wrote in message ... I have a workbook containing a worksheet called €śList€ť and many worksheet templates. I need a macro to select cells A1:H100 on any of the worksheet templates, copy all data within this range but only if A1:A100 is not blank, and then paste the data on the worksheet called €śList€ť. Ill use a button to activate the macro on each individual worksheet template. When the user activates the macro on the first template, the data will be copied and pasted to the €śList€ť starting at cell A1. When the user activates the macro on any of the subsequent templates, the data will copied and pasted on the €ślist€ť starting at the next empty row in column A. In other words, I want the user to be able to add data to the list from any of the templates. I dont have much experience with vba therefore, any help for a novice to apply this would be greatly appreciated. Thanks in advance, Tom |
Macro to create a list
Hi Otto,
This is going to work GREAT but I forgot to mention that it needs to paste as "paste special values". That way, I can get the raw data without any formats, etc. Thanks so much for your help! Tom "Otto Moehrbach" wrote: Try this. Post back if you need more. HTH Otto Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest End With End If End Sub "tomhelle" wrote in message ... I have a workbook containing a worksheet called €śList€ť and many worksheet templates. I need a macro to select cells A1:H100 on any of the worksheet templates, copy all data within this range but only if A1:A100 is not blank, and then paste the data on the worksheet called €śList€ť. Ill use a button to activate the macro on each individual worksheet template. When the user activates the macro on the first template, the data will be copied and pasted to the €śList€ť starting at cell A1. When the user activates the macro on any of the subsequent templates, the data will copied and pasted on the €ślist€ť starting at the next empty row in column A. In other words, I want the user to be able to add data to the list from any of the templates. I dont have much experience with vba therefore, any help for a novice to apply this would be greatly appreciated. Thanks in advance, Tom . |
Macro to create a list
Try this. HTH Otto
Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then Application.ScreenUpdating = False With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest.PasteSpecial xlPasteValues End With Application.ScreenUpdating = True End If End Sub "tomhelle" wrote in message ... Hi Otto, This is going to work GREAT but I forgot to mention that it needs to paste as "paste special values". That way, I can get the raw data without any formats, etc. Thanks so much for your help! Tom "Otto Moehrbach" wrote: Try this. Post back if you need more. HTH Otto Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest End With End If End Sub "tomhelle" wrote in message ... I have a workbook containing a worksheet called €śList€ť and many worksheet templates. I need a macro to select cells A1:H100 on any of the worksheet templates, copy all data within this range but only if A1:A100 is not blank, and then paste the data on the worksheet called €śList€ť. Ill use a button to activate the macro on each individual worksheet template. When the user activates the macro on the first template, the data will be copied and pasted to the €śList€ť starting at cell A1. When the user activates the macro on any of the subsequent templates, the data will copied and pasted on the €ślist€ť starting at the next empty row in column A. In other words, I want the user to be able to add data to the list from any of the templates. I dont have much experience with vba therefore, any help for a novice to apply this would be greatly appreciated. Thanks in advance, Tom . |
Macro to create a list
Thank you so much Otto! That worked beautiful!!
"Otto Moehrbach" wrote: Try this. HTH Otto Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then Application.ScreenUpdating = False With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest.PasteSpecial xlPasteValues End With Application.ScreenUpdating = True End If End Sub "tomhelle" wrote in message ... Hi Otto, This is going to work GREAT but I forgot to mention that it needs to paste as "paste special values". That way, I can get the raw data without any formats, etc. Thanks so much for your help! Tom "Otto Moehrbach" wrote: Try this. Post back if you need more. HTH Otto Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest End With End If End Sub "tomhelle" wrote in message ... I have a workbook containing a worksheet called €śList€ť and many worksheet templates. I need a macro to select cells A1:H100 on any of the worksheet templates, copy all data within this range but only if A1:A100 is not blank, and then paste the data on the worksheet called €śList€ť. Ill use a button to activate the macro on each individual worksheet template. When the user activates the macro on the first template, the data will be copied and pasted to the €śList€ť starting at cell A1. When the user activates the macro on any of the subsequent templates, the data will copied and pasted on the €ślist€ť starting at the next empty row in column A. In other words, I want the user to be able to add data to the list from any of the templates. I dont have much experience with vba therefore, any help for a novice to apply this would be greatly appreciated. Thanks in advance, Tom . . |
Macro to create a list
You're welcome. Thanks for the feedback. Otto
"tomhelle" wrote in message ... Thank you so much Otto! That worked beautiful!! "Otto Moehrbach" wrote: Try this. HTH Otto Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then Application.ScreenUpdating = False With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest.PasteSpecial xlPasteValues End With Application.ScreenUpdating = True End If End Sub "tomhelle" wrote in message ... Hi Otto, This is going to work GREAT but I forgot to mention that it needs to paste as "paste special values". That way, I can get the raw data without any formats, etc. Thanks so much for your help! Tom "Otto Moehrbach" wrote: Try this. Post back if you need more. HTH Otto Sub CopyData() Dim Dest As Range If Application.CountA(Range("A1:A100")) 0 Then With Sheets("List") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) Range("A1:H100").Copy Dest End With End If End Sub "tomhelle" wrote in message ... I have a workbook containing a worksheet called €śList€ť and many worksheet templates. I need a macro to select cells A1:H100 on any of the worksheet templates, copy all data within this range but only if A1:A100 is not blank, and then paste the data on the worksheet called €śList€ť. Ill use a button to activate the macro on each individual worksheet template. When the user activates the macro on the first template, the data will be copied and pasted to the €śList€ť starting at cell A1. When the user activates the macro on any of the subsequent templates, the data will copied and pasted on the €ślist€ť starting at the next empty row in column A. In other words, I want the user to be able to add data to the list from any of the templates. I dont have much experience with vba therefore, any help for a novice to apply this would be greatly appreciated. Thanks in advance, Tom . . |
All times are GMT +1. The time now is 01:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com