AutoFill on Dynamic Range to Visible Cells

jognat

New Member
Joined
Aug 24, 2012
Messages
3
Hello all,

I am new to Macros/VBA and have been lurking around trying to piece together something that will work for what I need to do, but I have been unsucessful.

Situation: I am looking to AutoFill a dynamic column range to only visbile cells.

This is what I have pieced together so far:

Code:
Range("R3").Select
    ActiveCell.FormulaR1C1 = "MS Related"
    Dim endRow As Long
        endRow = Cells(Rows.Count, "A").End(xlUp).Row
        ActiveCell.AutoFill Destination:=Range(ActiveCell.Address & ":R" & endRow)

This works great for filling the column with the text "MS Related," but I have not been able to accomplish the same thing while only applying it to the visible cells (the data set is filtered).

My issue is trying to figure out how -
Code:
SpecialCells(xlCellTypeVisible)
- plays into what I want to accomplish?

Any suggestions on how to solve this?

Thanks for your help.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Consider:

Code:
Range("R3:R" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Value = "MS Related"

All the rest is garbage and can (should) be left out.
 
Upvote 0

Forum statistics

Threads
1,215,422
Messages
6,124,811
Members
449,191
Latest member
rscraig11

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