Auto fill using VBA - need a

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
495
Office Version
  1. 2010
Platform
  1. Windows
I'm trying to solve an autofill problem. I've been manually typing in the following into cell D2 and then manually doing an autofill.

=SUBSTITUTE(D$1,"#",TRIM(RIGHT(SUBSTITUTE(A2,"/",REPT(" ",255)),255)))

How do I modify the VBA routine to continue autofill in col. D as long as there is something contained in Col. A? I'm just learning VBA so I know the code I put together is full of holes. Would appreciate some help.

Code:
Sub Do_It()
    With Range("D:D")
        If Range ("A:A") <> 0
            Then
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=SUBSTITUTE(R1C,""#"",TRIM(RIGHT(SUBSTITUTE(RC[-3],""/"",REPT("" "",255)),255)))"
        .Value = .Value
    End With
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
How about...

Code:
Sub Do_It()
    With Range("D2:D" & Range("A" & Rows.Count).End(xlUp).Row)
        .FormulaR1C1 = "=SUBSTITUTE(R1C,""#"",TRIM(RIGHT(SUBSTITUTE(RC[-3],""/"",REPT("" "",255)),255)))"
        .Value = .Value
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

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