ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code instead of foumula. (https://www.excelbanter.com/excel-programming/310763-re-code-instead-foumula.html)

Tom Ogilvy

Code instead of foumula.
 
You still need to use the formula.

Just use code to change the formula itself

ans = Inputbox("Enter the last two digits for 04-##")
ans = Trim(ans)
if len(ans) < 2 or not isnumeric(ans) then
msgbox "Invalid entry"
exit sub
End if
sStr = Range("B9").formula
sStr = left(sStr,42) & ans & right(str,16)
Range("B9").Formula = sStr

--
Regards,
Tom Ogilvy




"Erik" wrote in message
...
I have the following formula in a couple of cells and want to use code

instead.

='P:\NAP Office\VT-31 Classes\[VT31 FY 04-37.xls]Tracker'!C9

The formula refers to another workbook on another drive. The reason I

want
to use code instead is that I want to be able to change the reference at

the
04-37 portion of the formula through an input box to other numbers in the
same general format ie. 04-##. Any thoughts?
Erik





All times are GMT +1. The time now is 07:54 AM.

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