View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Autofill across columns

set rng = Activesheet.UsedRange
lastCol = rng.columns(rng.columns.count).Column
Range(C21,Cells(21,lastcol)).Formula = Range("B21").formula

--
Regards,
Tom Ogilvy

"Willy" wrote in message
...
Hello All!
I'm looking for the code that would allow me to autofill a formula from

the first column all the way to the last column.
The number of columns in the sheet changes every time. I will be placing

the formula in cell B21, and I want to
autofill it across to the last column. Any help would be greatly

apprieciated. Thanks in advance for your time and help!
Willy