Selection.FillDown Help

drozek

Board Regular
Joined
Aug 3, 2011
Messages
67
I will start this off, I don't program at all, I have been recording and modifying code macros to help automate some things at work. I have this code that's not working when I run it:

Columns("C:C").Select
ActiveSheet.Range("$C$1:$C$817").AutoFilter Field:=3, Criteria1:="202*"
ActiveSheet.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 2).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "'202 DIA"
With Worksheets("Data").AutoFilter.Range
Range("C" & .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Select
End With
Selection.FillDown

I want it to fill down all the filtered cells that start with 202 with 202 DIA.

Any help?
 
You'd use Mid(...,2,3) instead of left(...,4)

So when I use this below, it returns "#VALUE!" in the entire Col F

Sub ChangeZackman()
'
' This macro replaces 347 in Col E with Zackman in Col F
'
With Range("F1", Range("E" & Rows.Count).End(xlUp).Offset(, 1))
.Value = Evaluate(Replace("if(mid(" & .Offset(, -1).Address & ",2)=""347"",""Zackman"",@)", "@", .Address))
End With
End Sub
 
Last edited:
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You've missed off the last part of the Mid, it should be
Code:
.Value = Evaluate(Replace("if(mid(" & .Offset(, -1).Address & ",2[COLOR=#ff0000],3[/COLOR])=""347"",""Zackman"",@)", "@", .Address))
 
Upvote 0
You've missed off the last part of the Mid, it should be
Code:
.Value = Evaluate(Replace("if(mid(" & .Offset(, -1).Address & ",2[COLOR=#ff0000],3[/COLOR])=""347"",""Zackman"",@)", "@", .Address))


Anyone ever tell you, you are the best? This helped me automate a 30 minute report, I run every Monday. I have a few more questions, but will post when it comes time for it. Should I open a new thread or just post on here?
 
Upvote 0
You're welcome & thanks for the feedback
Best to start a new thread, for any further questions
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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