Replace in VBa

Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

in Excel I'm using formula:

Rich (BB code):
A2 = REPLACE(A1,1,FIND(":",A1),"").


Now in VBA I did like:
Rich (BB code):
ws.Range("A2").Value =
Rich (BB code):
"REPLACE(A1,1,FIND("":"",A1),"""")"
and it's ok.

How can I directly assign value from formula to my variable???
I had something like below but is wrong :/

Rich (BB code):
Dim new_value as String
new_value = "REPLACE(A1,1,FIND("":"",A1),"""")"
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
One way:

Code:
    Dim s As String
    
    s = Range("A1").Value
    s = Mid(s, InStr(s, ":") + 1)
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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