Change cell after macro

  • Thread starter Thread starter bgkgmg
  • Start date Start date
B

bgkgmg

I have a value in sheet1 AM4 of 101 along with a macro assigned to a text
box. I would like the value in AM4 to change to 102 after macro is run.

Thanks
 
Make something like this the last line of your macro

Sheets("Sheet1").Range("AM4").Value = Sheets("Sheet1").Range("AM4").Value + 1


Mike

:
 
hello , mike , it hopefully work!
i have simillar issue with cell , but is a verion compatibily,
when we migrating a previous Excel xls project call to the com objects for
each task, in upgrade to office 2007, using Vsto by C#, we change out some
the template's cs, code for comptible to office 2007 , in the scope of:
sheet. column object, column's max size -- in sheet .Column range from
(AA:ZZ) to (A:IV)

cAll= (Excel.Range)this.Sheet.Columns[ "A:IV", Type.Missing ];

b/c office 2007 is change to IV. then the column cell is not creating in
design time of the project runing , there is a exception throw :

system.Runtime.InteropServices.COMException (0x80020005): Type mismatch.
we not yet know how to ..
have any one got that ? any suggetion? you help are highly appreciated.

Chan
 
Mike H said:
Make something like this the last line of your macro

Sheets("Sheet1").Range("AM4").Value = Sheets("Sheet1").Range("AM4").Value + 1
It worked but leads me to additional question. When I run macro it moves info from invoice 101 to a master sheet row invoice 101 along with locking cells and protecting sheet which is what I want. Without your formula when I enter 102 and run macro the IF Then statement moves info to 102. With your formula added sheet1 shows 102 but master sheet remains protected.
I hope you understand and thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top