ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   R1C1 Error with Merged Cells (https://www.excelbanter.com/excel-programming/358016-r1c1-error-merged-cells.html)

bobwilson[_20_]

R1C1 Error with Merged Cells
 

I was using the below code to populate data from a combobox. It was
working great until I tried to use R1C1 to put data into a Merged cell
below(I guess Right 0.5) from the Master Reference Cell (Master is two
merged cells).

I was thinking that it would just be easier to Dim the String however I
couldn't get it to work in the bottom code Offset.

Does any one have an idea.


*** Works but misses target because I have merged cells ***

With ActiveSheet.Range("F105") ' Name

..Value = c.Offset(, 1) ' Name
..Offset(23, 1) = c.Offset(, 11) ' Province ***This missing the cell due
to merging***


****My Attempt at Code for Dim****

Dim provincelcb As String

provincelcb = ActiveSheet.Range("G128")

With ActiveSheet.Range("F105") ' Name

..Value = c.Offset(, 1) ' Name

..provincelcb = c.Offset(, 11) ' Province - I tried this however it
fails.


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529732


Toppers

R1C1 Error with Merged Cells
 
What is c (as in c.offset)? Where/how is it defined/set?


You could try this .....

Dim provincelcb As Range

set provincelcb = ActiveSheet.Range("G128")

With ActiveSheet.Range("F105") ' Name

..Value = c.Offset(, 1) ' Name

provincelcb = c.Offset(, 11) ' Province

"bobwilson" wrote:


I was using the below code to populate data from a combobox. It was
working great until I tried to use R1C1 to put data into a Merged cell
below(I guess Right 0.5) from the Master Reference Cell (Master is two
merged cells).

I was thinking that it would just be easier to Dim the String however I
couldn't get it to work in the bottom code Offset.

Does any one have an idea.


*** Works but misses target because I have merged cells ***

With ActiveSheet.Range("F105") ' Name

.Value = c.Offset(, 1) ' Name
.Offset(23, 1) = c.Offset(, 11) ' Province ***This missing the cell due
to merging***


****My Attempt at Code for Dim****

Dim provincelcb As String

provincelcb = ActiveSheet.Range("G128")

With ActiveSheet.Range("F105") ' Name

.Value = c.Offset(, 1) ' Name

.provincelcb = c.Offset(, 11) ' Province - I tried this however it
fails.


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529732




All times are GMT +1. The time now is 05:30 PM.

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