PDA

View Full Version : Couple days of work - now lost



Evertrue
01-24-2011, 01:43 PM
Hello all


I know this is my first post, but I have been searching for answer to something for couple day now and can't get anything to work.

I am sorting with auto filter.

the L column I amd searching for blanks
The k column I am searching for ends with X

When the filters come up ...

Now in VBA I want to search for the visible rows and fill in column L with 554988.

I have tried a for loop

for i = 0 to I NEED TO COUNT VISIBLE ROW

that is the first issue

the second issue is how do I loop through only the visible cells minus the header and fill them in.

Any help woudl be GREAT!

Evertrue
01-24-2011, 02:13 PM
OH yeah i forgot to add I cannot just select colum L through the code and insert because the row numbers vary from 1600 to well over 5000 rows

mdmackillop
01-24-2011, 03:15 PM
Welcome to VBAX
I'm not sure if this meets your needs
Sub Tests()
Dim LastCell As Range
Dim Rng As Range
Set LastCell = Columns(11).Find("x")
Set Rng = Range(Cells(2, 12), Cells(LastCell.Row, 12))
Rng.SpecialCells(xlCellTypeBlanks).Offset(, -1).Value = 554998
End Sub
If not, please post your workbook using Manage Attachments in the Go Advanced reply section.

mikerickson
01-24-2011, 04:05 PM
After applying the filter
With Range("L:L")
Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp)).SpecialCells(xlCellTypeVisible).Value = 554988
End With