proper syntax for With Rng/Evaluate?

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
751
Office Version
  1. 365
Platform
  1. Windows
i have a range(1000 rows) that i want to apply a change to. Its basically taking a variable and placing at the front of each string along with a comma. here is a before and after

6 of 1998 3-0-1 100.00% 14-18-2 43.75%
36, 6 of 1998 3-0-1 100.00% 14-18-2 43.75%

variable was 36 in this case. I though it was simple enough, but i get a 'Type MisMatch' error.

What is proper syntax, would EVALUATE help out?? thanks


Code:
Formula = 36

With Rng
    .Value = Formula & "," & .Value
End With
 
Like
Code:
Sub ilcaa()
   Dim Strategy As String
   Strategy = "36"
   With Range("A1", Range("A" & Rows.Count).End(xlUp))
      .Value = Evaluate("If({1},""" & Strategy & ", ""&" & .Address & ")")
   End With
End Sub
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
is there anyway you can explain why so many quotes are needed, why they are placed where they are? i cant figure out the logic of these evaluate statements especially with so many quotes and & symbols...
 
Upvote 0
May be you could clearly explain your expected ' final result ' ...
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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