ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value of Merged Cells (https://www.excelbanter.com/excel-programming/423787-value-merged-cells.html)

MLT[_3_]

Value of Merged Cells
 
I am trying to get at the value of the merged cells E1:G1.

This code works fine:
value_merge2 = Sheets("Sheet2").Range("E1").Value
MsgBox value_merge1

This code just gives a blank:
value_merge1 = Sheets("Sheet2").Range("A1").Offset(0, 4).Value
MsgBox value_merge2

Is there a way to use something like the second set of code to still
give the value of the merged cells?


Dave Peterson

Value of Merged Cells
 
Could it be that you got your variables mixed up.

value_merge2 is assigned, then you use msgbox value_merge2

And same thing with the next statement.

ps. The code worked fine for me in my simple testing.

MLT wrote:

I am trying to get at the value of the merged cells E1:G1.

This code works fine:
value_merge2 = Sheets("Sheet2").Range("E1").Value
MsgBox value_merge1

This code just gives a blank:
value_merge1 = Sheets("Sheet2").Range("A1").Offset(0, 4).Value
MsgBox value_merge2

Is there a way to use something like the second set of code to still
give the value of the merged cells?


--

Dave Peterson


All times are GMT +1. The time now is 10:38 PM.

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