ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select merged cells (https://www.excelbanter.com/excel-programming/309043-select-merged-cells.html)

Max Potters

select merged cells
 
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



mangesh_yadav[_85_]

select merged cells
 
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

--
Message posted from http://www.ExcelForum.com


Don Guillett[_4_]

select merged cells
 
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

--
Don Guillett
SalesAid Software

"Max Potters" wrote in message
...
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





Tom Ogilvy

select merged cells
 
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.
--
Regards,
Tom Ogilvy

"mangesh_yadav " wrote in
message ...
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

- Mangesh


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com