I am stumbling on how I can create a selection of worksheets based on a value in a specified cell.
Example:
If sheet1 cell D4 value is "10" and sheet2 cell D4 value is "10" I then need to select these and copy the sheets as a group, pasting at the end of the last sheet with the cell D4 value of "10" (sheet2). Of course I wont know what sheets will have the value.
I can get the values of the cells for each sheet, I do not know how to put this in some array(?) to select and copy sheets.
(assume option explicit)
As always, any input is appreciated.![]()
For i = 4 To Worksheets.Count 'Ignore first three sheets Sheets(i).Activate If ActiveSheet.Name <> "ListA" Then 'ignore sheet named "ListA" MsgBox Range("D4").Value 'for testing 'copy worksheets as group based on operation number Else: GoTo LastSheet End If LastSheet: Next i
Bookmarks