View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dht[_2_] dht[_2_] is offline
external usenet poster
 
Posts: 13
Default Can someone explain this code to me

I was given this code as a solution to inserting data in a cell down to the
the last cell

This references the cell to the immediate left to tell how many rows there
are.

How to I get it to look at a column 2 to the left or 1 to the right.

Range("E10").Select
ActiveCell.FormulaR1C1 = "stuff to insert"
Set rng = Selection(1, 1)
Set rng1 = Intersect(rng.CurrentRegion, Columns(rng.Column))
crTopRow = rng1.Rows(1).Row
Set rng1 = rng1.Offset(rng.Row - crTopRow, 0). _
Resize(rng1.Rows.Count - (rng.Row - crTopRow))
If rng1.Count 1 Then
Selection.AutoFill rng1
End If

Thanks (again)
Dave