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
Post a Comment