Evaluate VBA

bjurney

Active Member
Joined
Aug 24, 2009
Messages
320
I am trying to use the evaluate in my code so I dont have a bunch of formulas in my workbook. what I am trying to do is get it so it looks something like this:

Code:
Range("L20").Value = Evaluate("=D2")
Range("L21").Value = Evaluate("=D3")

I need it to run down several hundred rows, so I dont want to type that out 100's of times, so I am wondering if there is a way to get it to work with using less code. I tired something like this, but they all end up equaling the same thing, I need it to equal the next cell down:

Code:
Range("L20:L21").Value = Evaluate("=D2")
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Code:
Sub test()
Range("D2:D200").Copy
Range("L20").PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub
 
Upvote 0
Or, maybe...

Code:
With Range("L20:L21")
    .Formula = "=D2"
    .Value = .Value
End With
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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