matthew22194
11-26-2024, 10:02 PM
Hello there,
I am new to VBA and have been learning by tackling small automation tasks in Excel. Although; I have hit a bit of a roadblock with a project; and I am hoping someone here can offer guidance.
Contains multiple sheets, and each sheet has data in different ranges. Needs to receive specific data from the Source Workbook based on certain criteria.
The goal is to automate the transfer of data based on the following conditions.
Copy data from specific ranges in the Source Workbooks various sheets. Paste the data into corresponding sheets in the Destination Workbook.
Ensure that only rows with non-blank values in column A are copied. Ideally; clear the existing data in the Destination Workbook before pasting the new data.
I have managed to write a simple macro to copy and paste between two sheets.
Sub TransferData()
Dim srcWB As Workbook
Dim destWB As Workbook
Set srcWB = Workbooks("Source.xlsx")
Set destWB = Workbooks("Destination.xlsx")
' Example of copying data - needs improvement
srcWB.Sheets(1).Range("A2:D100").Copy
destWB.Sheets(1).Range("A1").PasteSpecial Paste:=xlPasteValues
End Sub
Loop through multiple sheets in the Source Workbook. Copy data conditionally based on column A.
Clear the previous data in the Destination Workbook without affecting the structure.
Thanks in advance for your help and assistance.
I am new to VBA and have been learning by tackling small automation tasks in Excel. Although; I have hit a bit of a roadblock with a project; and I am hoping someone here can offer guidance.
Contains multiple sheets, and each sheet has data in different ranges. Needs to receive specific data from the Source Workbook based on certain criteria.
The goal is to automate the transfer of data based on the following conditions.
Copy data from specific ranges in the Source Workbooks various sheets. Paste the data into corresponding sheets in the Destination Workbook.
Ensure that only rows with non-blank values in column A are copied. Ideally; clear the existing data in the Destination Workbook before pasting the new data.
I have managed to write a simple macro to copy and paste between two sheets.
Sub TransferData()
Dim srcWB As Workbook
Dim destWB As Workbook
Set srcWB = Workbooks("Source.xlsx")
Set destWB = Workbooks("Destination.xlsx")
' Example of copying data - needs improvement
srcWB.Sheets(1).Range("A2:D100").Copy
destWB.Sheets(1).Range("A1").PasteSpecial Paste:=xlPasteValues
End Sub
Loop through multiple sheets in the Source Workbook. Copy data conditionally based on column A.
Clear the previous data in the Destination Workbook without affecting the structure.
Thanks in advance for your help and assistance.