Insert a variant into a cell formula

Rodney Jorgensen

Active Member
Joined
Nov 9, 2007
Messages
411
I am trying to take the ActiveCell.Address and insert that as variant i into a cells formula. I think I have done something like this before, but the " " marks are throwing me off. The Variant i inside of the " " is not taking on the activecell.address.

Code:
    Dim i As Variant

    i = ActiveCell.Address
    Range("D1") = "=LEFT(i,LEN(i)-14)"
    Range("D2") = "=MID(i,LEN(i)-12,2)"
    Range("D3") = "=RIGHT(i,10)"

Thanks for all your help
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
like this
Rich (BB code):
    Dim i As Variant
 
    i = ActiveCell.Address
    Range("D1") = "=LEFT(" & i & ",LEN(" & i & ")-14)"
    Range("D2") = "=MID(" & i & ",LEN(" & i & ")-12,2)"
    Range("D3") = "=RIGHT(" & i & ",10)"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,207,387
Messages
6,078,197
Members
446,320
Latest member
vatra

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