ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change cell after macro (https://www.excelbanter.com/excel-programming/417643-change-cell-after-macro.html)

bgkgmg

Change cell after macro
 
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

Mike H

Change cell after macro
 
Make something like this the last line of your macro

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


Mike

"bgkgmg" wrote:



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


Chan

Change cell after macro
 
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" wrote:

Make something like this the last line of your macro

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


Mike

"bgkgmg" wrote:



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


bgkgmg

Change cell after macro
 


"Mike H" wrote:

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




Mike

"bgkgmg" wrote:



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



All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com