![]() |
visual basic Loop by rows in Excel
I have a data range with merged cells and other cells not merged in a
spreadsheet. I want to find only the merged cells so I can store a lookup function in them using visual basic. My problem is I can't figure out either how to enter the function in the merged cells only and stop the loop so it doesn't go into my titles, which are merged cells, and enter the function in those. Any ideas? Thanks -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200801/1 |
visual basic Loop by rows in Excel
I, among many, do not believe in merged cells but assuming your titles in
row 1, try this Sub findmergedcells() For Each c In Range("e2:e22") If c.MergeCells = True Then MsgBox c.Row Next End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Carrie_Loos via OfficeKB.com" <u34134@uwe wrote in message news:7e440d7506a12@uwe... I have a data range with merged cells and other cells not merged in a spreadsheet. I want to find only the merged cells so I can store a lookup function in them using visual basic. My problem is I can't figure out either how to enter the function in the merged cells only and stop the loop so it doesn't go into my titles, which are merged cells, and enter the function in those. Any ideas? Thanks -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200801/1 |
visual basic Loop by rows in Excel
Thanks - works great
Don Guillett wrote: I, among many, do not believe in merged cells but assuming your titles in row 1, try this Sub findmergedcells() For Each c In Range("e2:e22") If c.MergeCells = True Then MsgBox c.Row Next End Sub I have a data range with merged cells and other cells not merged in a spreadsheet. I want to find only the merged cells so I can store a lookup [quoted text clipped - 6 lines] Thanks -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200801/1 |
All times are GMT +1. The time now is 01:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com