Thread: paste formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default paste formula

Paste is not needed. The following will enter your formula into column A in
the first 10 cells:


Sub gsnu()
Dim r As Range
Set r = Range(Cells(1, 1), Cells(10, 1))
r.Formula = "=MONTH(12)"
End Sub
--
Gary''s Student


"geebee" wrote:

hi,

I am trying to find a way to paste a formula into a certain column in excel
using VBA. Trying to paste the following formula:

=MONTH(I2)


The code should go to the first rown, and then paste the formula for all
rows entered.


Thanks in advance,
geebee