excel - How to use a variable in a linked cell reference? -


very new vba, use matlab , python. i've got following section of code

sub example     dim num integer      num = 62     activesheet.checkboxes.add(23.25, 595.5, 101.25, 18.75).select      selection         .name = "newcheckbox"         sheets("ipt data").select         .caption = cells(num, "c")     end      sheets("ipt chart").select     activesheet.checkboxes("newcheckbox").select      selection         .value = xloff         .linkedcell = "'ipt data'!$a$num"         .display3dshading = false     end end sub 

i want linked cell refer anum. there way this? later num used in loop can't use standalone.

like say, new , basic stuff, apoligse. had search around , have tried use both cells , range no avail.

thanks

use

.linkedcell = "'ipt data'!$a$" & num 

but can avoid selecting , write:

option explicit sub example2()     dim num integer      num = 62     worksheets("ipt chart")         .checkboxes.add(23.25, 595.5, 101.25, 18.75)             .name = "newcheckbox"             .caption = worksheets("ipt data").cells(num, "c")             .value = xloff             .linkedcell = "'ipt data'!$a$" & num             .display3dshading = false         end     end end sub 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -