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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
One way:

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

Forum statistics

Threads
1,215,465
Messages
6,124,971
Members
449,200
Latest member
Jamil ahmed

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