I want copy a range with the following criteria
1 - Copy the entire row, including hidden columns
2 - If the Colunm "CC" has no value, them it will skip the entire row
Note Update = Sorry I forgot something, it won't always be two rows that will have data, sometimes they will have data in 3 4 5.... or in all the rows of the table
Note = My table has formulas so I don't want to mess with them, just copy the cell values
Im using this
Sub CopyVisible()
Worksheets(1).Range("B3:I13").Select
Selection.Copy
End Sub
And im getting this result
But i want this result
Im gonna copy to clipboard, then i will paste on another worksheet mannualy
CodePudding user response:
Change instruction
Worksheets(1).Range("B3:I13").Select
to
Worksheets(1).Range("B3:I4").Select
Then, only two rows (rows# 3 and 4) between columns B and I will be copied. When pasting excel shows pasting options: select option copy only values.
CodePudding user response:
i think the following code will do the job.
Sub CopyFilledCells()
Dim lngLastRow As Long
Sheet2.UsedRange.Clear
With Sheet1
lngLastRow = .Range("I2").End(xlDown).Row
.Range("B3:I" & lngLastRow).Copy Destination:=Sheet2.Range("A1")
End With
End Sub
Regards Bernd


