Using Cells notation

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,262
I have the following snippet of code:-

Code:
Selection.LinkedCell = "H" & x

However I have a loop where next time around the code will be:-

Code:
Selection.LinkedCell = "I" & x

and so on. How do I change the right side of the code and use the Cells notation to do what I want?
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Possibly

Code:
Selection.LinkedCell = Cells(X, icolumn).Address
 

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,939
Maybe a 2nd counter? or using offset?

You would need to post your current code because it is hard to work with what you have, but probably something similiar to:

Code:
Selection.LinkedCell = cells(x,y).address(0,0)
Hope that helps.
 

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,262
Selection.LinkedCell = Cells(X, icolumn).Address did the trick. Many thanks.
 

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,262

ADVERTISEMENT

Sorry to trouble you guys again, but I have another similar problem i.e.

Code:
                .Range("H" & x).Select
                .Range("H" & x).Value = True

I have the above code again running in a loop, where checkboxes are set to True or False i.e. H1, H2, H3, I1, I2, I3, J1, J2, J3, etc.
 

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,939
You should be able to do the same as above. With that example you would have 2 loops, one for rows going 1 to 3 and one for columns going 8 through 10.

Expande the columns and rows loop numbers as needed.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
There is no need to Select (and it slows your code down). Try something like

Code:
Cells(X, icolumn).Value = True
 

Watch MrExcel Video

Forum statistics

Threads
1,122,481
Messages
5,596,396
Members
414,063
Latest member
N_Bates

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
Top