Hi everyone,
I'm new to vba coding and I was wondering if you could help with this...
I have this code below that copies and pastes a range to a closed spreadsheet in a table.
At the moment it copies the whole range "F24:M27" which resides in the sheet "Setup", however I would like the code to copy only the row where the text "Check" is present in column "I" and therefore copy only that row and disregard the others (copy always from column F to M and not the entire row).
Dim destSht As Worksheet
Workbooks.Open ("H:\Project\Checklist tracker 2.xlsb") '<- at opening a workbook it becomes the active one
Set destSht = ActiveWorkbook.Worksheets("Checklist Table") '<-- set the destination worksheet in the activeworkbook
With ThisWorkbook.Worksheets("Setup") '<--refer to your source worksheet in the workbook this macro resides in
With .Range(.Range("F24:M27"), .Range("F24:M27").End(xlDown)) '<--| refer to the range whose values are to be copied
Application.GoTo Reference:="R10000C4"
destSht.Cells(destSht.Rows.count, 4).End(xlUp).Offset(1).Resize(.Rows.count, .Columns.count).Value = .Value '<--| copy values in a equally sized range in destination worksheet
End With
End With
destSht.Parent.Close True '<-- close the destination workbook
Thank you in advance!!
I'm new to vba coding and I was wondering if you could help with this...
I have this code below that copies and pastes a range to a closed spreadsheet in a table.
At the moment it copies the whole range "F24:M27" which resides in the sheet "Setup", however I would like the code to copy only the row where the text "Check" is present in column "I" and therefore copy only that row and disregard the others (copy always from column F to M and not the entire row).
Dim destSht As Worksheet
Workbooks.Open ("H:\Project\Checklist tracker 2.xlsb") '<- at opening a workbook it becomes the active one
Set destSht = ActiveWorkbook.Worksheets("Checklist Table") '<-- set the destination worksheet in the activeworkbook
With ThisWorkbook.Worksheets("Setup") '<--refer to your source worksheet in the workbook this macro resides in
With .Range(.Range("F24:M27"), .Range("F24:M27").End(xlDown)) '<--| refer to the range whose values are to be copied
Application.GoTo Reference:="R10000C4"
destSht.Cells(destSht.Rows.count, 4).End(xlUp).Offset(1).Resize(.Rows.count, .Columns.count).Value = .Value '<--| copy values in a equally sized range in destination worksheet
End With
End With
destSht.Parent.Close True '<-- close the destination workbook
Thank you in advance!!