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.
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: