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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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