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:

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Watch MrExcel Video

Forum statistics

Threads
1,090,045
Messages
5,412,026
Members
403,409
Latest member
IHRAcer

This Week's Hot Topics

Top