Formula in a string variable

durgy

New Member
Joined
Aug 9, 2011
Messages
9
I am concatenating 2 strings str1 and str3 in strTotal in Userforms VBA Excel 2007
When I save userform strTotal = str1 & str3 goes in sheet1!A2 and works fine.

Now there is requirement that I have to add a reference to sheet1!B2 in between the string. i.e when I save userform
strTotal = str1 & (something like =B2 ) & str3 goes in sheet1!A2. Later when user enters a value in B2 (which can vary) this value goes between str1 and str3 in sheet1!A2.
I have to do similar for 100 rows.
I am not sure how to do by VBA. I trying to avoid doing this by formula on the sheet.

Thanks
 
Thanks repairman615 the code works.

One thing I noticed is the first time user entry in C2 updates A2 correctly. But if the user comes back and edits/deletes C2 second time A2 does not update.
I am not sure what I am doing wrong.

Thanks
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hello,

Glad to hear the progress. Sounds like adding some additional code may work out the logic of what should happen.

What exactly would you like to happen on the second time?

How about for the third or more?

I did notice this while I was writing it... I was just glad to mainly get it working and did not know if that was an issure with your needs.
 
Upvote 0
Hello,

Thanks repairman615 you have pointed me in the right direction. never how many times the user will edit/delete.
I think I will be able to work out the additional code.

Thanks a lot for your help. Greatly appreciated
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top