Hello,
I can't find the ideal code to meet my needs.
I would like to copy the range of "A2:E..." according to the values of my "I" column.
In column "I" I will have either 1 or 0.
I would like a code that allows me to copy all the rows (from A2 to E...) at value 1 until the first row with a value of 0 in a dynamic way.
I am using this code now which will hide the rows with 0 values and then copy the rows and paste them into my Word file.
Could you please help me to improve this code section to make it more smooth and safe?
Thanks a lot
TBR68
I can't find the ideal code to meet my needs.
I would like to copy the range of "A2:E..." according to the values of my "I" column.
In column "I" I will have either 1 or 0.
I would like a code that allows me to copy all the rows (from A2 to E...) at value 1 until the first row with a value of 0 in a dynamic way.
I am using this code now which will hide the rows with 0 values and then copy the rows and paste them into my Word file.
VBA Code:
'Copy Overview page1
Sheets("Print_Content2").Select
'Hide rows when value = 0
For Each c In Range("I2:I1000")
c.EntireRow.Hidden = c.Value = "0"
Next
'Copy all rows with value 1 to Word bookmark
If ActiveSheet.Range("F2") = "1" Then
ActiveSheet.Range("A2:E1000").Copy
.Selection.Goto wdGoToBookmark, , , "OVER1"
.Selection.Paste
Else
'End If
Could you please help me to improve this code section to make it more smooth and safe?
Thanks a lot
TBR68