Getting information from merged cells

chakalido

New Member
Joined
Jul 18, 2014
Messages
16
Hello,

I am trying to get the values from merged cells (which are at the offset of a .find gcell result) through a loop that goes through rows one by one (and looks for specific values on an other sheet) .This code goes if the cell we are looking for is merged and does the following:

-Unmerges
-Gets the limits of the merged cells by the use of .Address
-looks for the value contained in these cells
-re-writes the value over them

At this point it doesn't work and I believe because of variable format as .address gives a string and the property rows.value and .MergeArea needs a range My question is, How can I change from an Address string to a range? Maybe like this I can fix this.
If you have any other siggestion I'll be glad to listen.

Thank you very much.

Code:
lineasemergidasCont = gCell.Offset(, 4).MergeArea.Rows.count
                                         emergidainicio = gCell.Offset(, 4).Address
                                         emergidafinal = gCell.Offset(lineasemergidasCont, 4).Address
                                         Range(emergidainicio, emergidafinal).MergeArea.UnMerge
                                         filainicio = emergidainicio.Rows.Value
                                         filafinal = emergidafinal.Rows.Value
                                             For p = filainicio To filafinal
                                                If  .Cells(p, 10).Value <> "" Then
                                                    .Cells(p, 10).Value = datoemergido
                                                End If
                                             Next p
                                             For s = filainicio To filafinal
                                                datoemergido = .Cells(s, 10).Value
                                             Next s
 
Last edited:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top