VBA for Excel Code

accessman2

Registered User.
Local time
Yesterday, 23:00
Joined
Sep 15, 2005
Messages
335
Hi,

I write VBA in MS Access

.Worksheets(3).cells(p,i) = 1
.Worksheets(3).cells(p+1,i) = 2
.Worksheets(3).cells(p+2,i) = 3

.Worksheets(3).cells(p+3,i).formula = "=Sum(" & .Worksheets(3).Cells(p, i) & ":" & .Worksheets(3).Cells(p+2, i) & ")"


But, the sum function doesn't work, because it only get the cells value, it needs cells name (eg. B2, B3, ...etc).

I want to use cells(p,i) to represent, because I make the variable column, and rows depend on the input parameters.

Please let me know, thanks.
 
..."=Sum(" & .Worksheets(3).Cells(p, i).Address & ":" & .Worksheets(3).Cells(p+2, i).Address & ")"
 

Users who are viewing this thread

Back
Top Bottom