Hi All,
I'm new here so apologies in advance if I overstep on the etiquette or for showing my ignorance.
I am really hoping you can help - my specific problem is as follows:
I have text data in merged cells on columns B to D for each row from 200 through to 213 (so 14 rows total).
I would like to copy them over into these target rows 7 to 20 in the same columns B to D, as merged. BUT - only if the target rows are visible rows.
There will be other macros at play that will be simply hiding certain rows within that range of 7 to 20 - hence, for example if the rows 11 to 20 were made hidden, I would like for the code to start copying into rows 7 to 10 then continue onward to row 21 (next visible row) thus, skipping the hidden rows in between.
I would expect the code to look for the next visible row and paste the next row from the source rows (200-213) into it whilst skipping any hidden rows.
Please note, rows 7 through 10 would never be hidden its only 11 through 20. I would also expect that whilst 7 is the 1st row, 108 will be the last.
If any help - this is my attempt so far which clearly doesn't work at all:
Sub VERSIONCONTROL_TAB_HideRows_TestMinus1()
Dim baseMenu As Range, cellBase As Range, cellTarget As Range, targetMenu As Range
Set baseMenu = Range("B200:D213")
Set targetMenu = Range("B7:D108")
For Each cellBase In baseMenu
For Each cellTarget In targetMenu
If Worksheets("TEST").Range("B7:D108").EntireRow.Hidden = False Then
Range("B200:D213").Copy Range("B7:D20")
Else: cell.Offset(1, 1).Value = True
End If
Next
Next
End Sub
I'm new here so apologies in advance if I overstep on the etiquette or for showing my ignorance.
I am really hoping you can help - my specific problem is as follows:
I have text data in merged cells on columns B to D for each row from 200 through to 213 (so 14 rows total).
I would like to copy them over into these target rows 7 to 20 in the same columns B to D, as merged. BUT - only if the target rows are visible rows.
There will be other macros at play that will be simply hiding certain rows within that range of 7 to 20 - hence, for example if the rows 11 to 20 were made hidden, I would like for the code to start copying into rows 7 to 10 then continue onward to row 21 (next visible row) thus, skipping the hidden rows in between.
I would expect the code to look for the next visible row and paste the next row from the source rows (200-213) into it whilst skipping any hidden rows.
Please note, rows 7 through 10 would never be hidden its only 11 through 20. I would also expect that whilst 7 is the 1st row, 108 will be the last.
If any help - this is my attempt so far which clearly doesn't work at all:
Sub VERSIONCONTROL_TAB_HideRows_TestMinus1()
Dim baseMenu As Range, cellBase As Range, cellTarget As Range, targetMenu As Range
Set baseMenu = Range("B200:D213")
Set targetMenu = Range("B7:D108")
For Each cellBase In baseMenu
For Each cellTarget In targetMenu
If Worksheets("TEST").Range("B7:D108").EntireRow.Hidden = False Then
Range("B200:D213").Copy Range("B7:D20")
Else: cell.Offset(1, 1).Value = True
End If
Next
Next
End Sub