select merged cells

M

Max Potters

Hi ,

I'm trying to select merged cells ("B25:B28"). When I type in the following
code, sheet1.range("B25").select, VB gives an error. I tried selecting the
whole range as well, but no success. Hope someone knows how to do this.

Thanks in advance

Max
 
M

mangesh_yadav

It should work perfectly. What error does VB give....?
If the error is: OBJECT REQUIRED, then the sheet name is not correct
otherwise it should work perfectly

- Manges
 
D

Don Guillett

any of these should work. You can't select a range w/o going to the sheet
but you can use goto

Sub selectmerged()
'Sheet5.Select
'Range("f3").Select

'Application.Goto Sheets("Sheet5").Range("f3")
Application.Goto Sheet5.Range("f3")

End Sub
 
T

Tom Ogilvy

the sheet with code name sheet1 would also need to be the active sheet.

sheet1.Activate
Sheet1.Range("B25").MergeArea.Select

mergearea shouldn't be required, but makes your intent clearer.
 
Top