formula assigned to a variable

  • Thread starter Thread starter crew3407
  • Start date Start date
C

crew3407

Hello again,

I'm trying to assign the value of a formula into a variable. The way
have it set up right now is...

Range("B3").Formula = "=LEFT(A1,1)"
M = Range("B3").Value

and then having to clear the contents later from cell B3.

How can I just assign the value of the formula right into the variabl
without going through this?

thanks!

Charle
 
Hi
for your example I would use
M=left(Range("A1"),1)

you may also take a look at
evaluate
and
application.worksheetfunction
in the VBA help
 
Hi Charles,

Dim M As String
M = Left(Range("A1"), 1)
MsgBox "The value of M is: " & M

This is really a question for the excel.programming
group since you are obviously working with a macro.
 
Back
Top