ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find Merged Cells (https://www.excelbanter.com/excel-discussion-misc-queries/121510-find-merged-cells.html)

Mike Rogers

Find Merged Cells
 
Bob Phillips provided this to an op on this forum and I would like a small
addition to it.
What would I add to this to have each occurance selected as each message box
appears?


Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem
End Sub

Thank you guys for all the help (and of course Bob)

Mike Rogers



Gary''s Student

Find Merged Cells
 
Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Range(collItem).Select
Next collItem
End Sub
--
Gary''s Student


"Mike Rogers" wrote:

Bob Phillips provided this to an op on this forum and I would like a small
addition to it.
What would I add to this to have each occurance selected as each message box
appears?


Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem
End Sub

Thank you guys for all the help (and of course Bob)

Mike Rogers



Mike Rogers

Find Merged Cells
 
Gary''s Student

That was easy! I was close but had the syntax turned around.
This selects the first occurance of merged cells after I move to the message
box indicating the second occurance. The selection is one behind the msg box.
Is there any way to have the msg box appear and the same range be selected
at the same time?

Thanks for your help!!!

Mike Rogers

"Gary''s Student" wrote:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Range(collItem).Select
Next collItem
End Sub
--
Gary''s Student


"Mike Rogers" wrote:

Bob Phillips provided this to an op on this forum and I would like a small
addition to it.
What would I add to this to have each occurance selected as each message box
appears?


Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem
End Sub

Thank you guys for all the help (and of course Bob)

Mike Rogers



Gary''s Student

Find Merged Cells
 
We will just reverse the selection with the msgbox:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
Range(collItem).Select
MsgBox collItem
Next collItem
End Sub
--
Gary's Student


"Mike Rogers" wrote:

Gary''s Student

That was easy! I was close but had the syntax turned around.
This selects the first occurance of merged cells after I move to the message
box indicating the second occurance. The selection is one behind the msg box.
Is there any way to have the msg box appear and the same range be selected
at the same time?

Thanks for your help!!!

Mike Rogers

"Gary''s Student" wrote:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Range(collItem).Select
Next collItem
End Sub
--
Gary''s Student


"Mike Rogers" wrote:

Bob Phillips provided this to an op on this forum and I would like a small
addition to it.
What would I add to this to have each occurance selected as each message box
appears?


Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem
End Sub

Thank you guys for all the help (and of course Bob)

Mike Rogers



Mike Rogers

Find Merged Cells
 
Gary''s Student

Very simple, very easy!!!! Thank you for your time and knowledge!!!

Mike Rogers

"Gary''s Student" wrote:

We will just reverse the selection with the msgbox:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
Range(collItem).Select
MsgBox collItem
Next collItem
End Sub
--
Gary's Student


"Mike Rogers" wrote:

Gary''s Student

That was easy! I was close but had the syntax turned around.
This selects the first occurance of merged cells after I move to the message
box indicating the second occurance. The selection is one behind the msg box.
Is there any way to have the msg box appear and the same range be selected
at the same time?

Thanks for your help!!!

Mike Rogers

"Gary''s Student" wrote:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Range(collItem).Select
Next collItem
End Sub
--
Gary''s Student


"Mike Rogers" wrote:

Bob Phillips provided this to an op on this forum and I would like a small
addition to it.
What would I add to this to have each occurance selected as each message box
appears?


Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem
End Sub

Thank you guys for all the help (and of course Bob)

Mike Rogers



Gary''s Student

Find Merged Cells
 
You are very welcome. Also thanks to Bob, who teaches me something new
nearly evey day.
--
Gary's Student


"Mike Rogers" wrote:

Gary''s Student

Very simple, very easy!!!! Thank you for your time and knowledge!!!

Mike Rogers

"Gary''s Student" wrote:

We will just reverse the selection with the msgbox:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
Range(collItem).Select
MsgBox collItem
Next collItem
End Sub
--
Gary's Student


"Mike Rogers" wrote:

Gary''s Student

That was easy! I was close but had the syntax turned around.
This selects the first occurance of merged cells after I move to the message
box indicating the second occurance. The selection is one behind the msg box.
Is there any way to have the msg box appear and the same range be selected
at the same time?

Thanks for your help!!!

Mike Rogers

"Gary''s Student" wrote:

Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Range(collItem).Select
Next collItem
End Sub
--
Gary''s Student


"Mike Rogers" wrote:

Bob Phillips provided this to an op on this forum and I would like a small
addition to it.
What would I add to this to have each occurance selected as each message box
appears?


Sub FindMergedCells() 'Bob Phillips
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:Z150")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem
End Sub

Thank you guys for all the help (and of course Bob)

Mike Rogers




All times are GMT +1. The time now is 07:32 AM.

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