stirlingmw1
Board Regular
- Joined
- Jun 17, 2016
- Messages
- 53
- Office Version
- 2016
- 2013
- 2010
- 2007
- Platform
- Windows
Afternoon all
I have a workbook that I import data as a worksheet "ImportData" and that then adds this data from "ImportData" to the worksheet "Main" for manipulation. I am using the following code to copy data from the first 3 columns of importdata to main that populates from row 4 until all data rows are filled.
What I am now trying to do is copy the remaining data from "ImportData" row 4 to lastrow Columns D to AC to "Main" row 4 Column F to BD but this time when data is copied from column D from the "ImportData" sheet it will be copied to the "Main" worksheet column F, then from ImportData column E to Main Column H so in effect leaving a blank column between the each column of copied data.
I hope I have explained that correctly and you can help.
regards
Steve
I have a workbook that I import data as a worksheet "ImportData" and that then adds this data from "ImportData" to the worksheet "Main" for manipulation. I am using the following code to copy data from the first 3 columns of importdata to main that populates from row 4 until all data rows are filled.
VBA Code:
Sub AddDataToMain()
Dim ImpLRow As Long, MLRow
Dim wsI As Worksheet, wsM As Worksheet
Set wsM = Worksheets("Main")
Set wsI = Worksheets("ImportData")
'Adds NSN ADAC and Description to Main page
ImpLRow = wsI.cells(Rows.Count, 1).End(xlUp).Row
MLRow = wsM.cells(Rows.Count, 1).End(xlUp).Row
wsM.Range("A4:C" & ImpLRow).Value = wsI.Range("A4:C" & ImpLRow).Value
End Sub
What I am now trying to do is copy the remaining data from "ImportData" row 4 to lastrow Columns D to AC to "Main" row 4 Column F to BD but this time when data is copied from column D from the "ImportData" sheet it will be copied to the "Main" worksheet column F, then from ImportData column E to Main Column H so in effect leaving a blank column between the each column of copied data.
I hope I have explained that correctly and you can help.
regards
Steve