excel - Changing multiple cells values using a command Button -


i trying figure out how change 3 cells on 3 different sheets same value command button caption. have managed working if there 1 command can't seem work on multiple commands.

private sub cmdsme100_click()      worksheets("calculator").range("i1") = me.cmdsme100.caption     worksheets("tariff matrix").range("a1") = me.cmdsme100.caption     worksheets("bolt-on matrix").range("a1") = me.cmdsme100.caption  end sub 

as stands code trying work. , can't seem figure out why wont work on different sheets.

i need work cells asking code change trigger auto filter.

any advise appreciated.

thanks

maybe can try "activating" sheets. considering "calculator" sheet1, "tariff matrix" sheet2 , "bolt-on matrix" sheet 3;

private sub cmdsme100_click() sheet1.activate sheet1.range("a1") = me.cmdsme100.caption sheet2.activate sheet2.range("a1") = me.cmdsme100.caption sheet3.activate sheet3.range("a1") = me.cmdsme100.caption end sub 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -