oh right sorry i have loaded them into a array so you can access them sheets, sorry i didnt realise that you wanted them selected. i will have a look to see if i can work that one out
oh right sorry i have loaded them into a array so you can access them sheets, sorry i didnt realise that you wanted them selected. i will have a look to see if i can work that one out
There are only 10 types of people in the world:
Those who understand binary, and those who don't!
ok
cheers
sorry roasty_1, i cant seem to get it to work no matter what i try.
does anybody else know how to do this as i am now interested.
Try attached file.
Regards,
Antonio
Thanks Antonio
Works well, only it crashes Excel if any of the cells are left blank, not an issue though, can work round that.
thanks for your help.
There are a couple of ways of selecting the sheets.
Either using the Replace argument or by building an array of sheetnames.
![]()
Private Sub SelectSheets_Click() Dim blnReplace As Boolean Dim lngRow As Long blnReplace = True For lngRow = 3 To 21 If Cells(lngRow, 2) = "Y" Then Sheets(Cells(lngRow, 1).Value).Select blnReplace blnReplace = False End If Next MsgBox "Using Replace" Me.Select ' clear selection Dim lngNSheets As Long Dim lngCount As Long lngNSheets = Application.WorksheetFunction.CountIf(Range("B3:B21"), "Y") ReDim vntSheets(1 To lngNSheets) As Variant For lngRow = 3 To 21 If Cells(lngRow, 2) = "Y" Then lngCount = lngCount + 1 vntSheets(lngCount) = Cells(lngRow, 1) End If Next Sheets(vntSheets).Select MsgBox "Using array" End Sub
Hi Andy
thanks for your help, couldnt get your code to work unfortunetly, thanks anyway.
In what way did it not work?
raised an error
No selection of sheets
weird, it works now, before I was getting an Object error
Now works fine
Thanks!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks