Thread: Macro help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mallycat
 
Posts: n/a
Default Macro help


TimmerSuds Wrote:
I need it to paste SLS into all rows in Column G that are not blank
(this can vary from 1 to 500 rows).

Not Blank? or blank? How will you know how many rows there are? you
need a column that you know will have data in the last row. I'll
assume that Column A has data in every row. Also, is the data in col G
before you insert the new column or after? You will need to swap the
code around if it is before.


Sub UpdateSLS()
Dim myRange As Range
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Range("C1").Value = "SLS"
Range("C2:C33").Value = "SLS"
LastRow = Range("A600").End(xlUp).Row
myAddress = "G1:G" & LastRow
Set myRange = Range(myAddress)
For Each cell In myRange
If cell.Value < "" Then cell.Value = "SLS"
Next cell

End Sub


--
Mallycat
------------------------------------------------------------------------
Mallycat's Profile: http://www.excelforum.com/member.php...o&userid=35514
View this thread: http://www.excelforum.com/showthread...hreadid=553818