.cells help

C

Carl Brehm

Why does the following return an error 1004?

..Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""

With Range("weekending")(1, 1)
.Offset(0, (columncount)).Value = monthdate
'assigns weekending date to column heading on Worksheet("vendor_totals")
.Offset(1, (columncount)).Value = Sheets("sheet1").Range("h1").Value
'assigns sq footage value for week
.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""
'assign formula SUM(current column row6: current column row 200)
End With

--
Carl Brehm
Lake Lafourche Bird House
Hebert, LA

Keets, Tiels, GN Lories, Quakers
Mitred Conures, TAG's, Bourkes
Lovebirds, Cherry Head Conures
Prince of Whales

Wholesale Cages to Breeders & Pet Stores
 
B

Bob Phillips

Haven't tested it, but probably because you are using the default value property. Try this

Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount).Address & ":" & .Cells(200, columncount).Address & ")"""

and adjust the other one similarly

--

HTH

RP
(remove nothere from the email address if mailing direct)


Why does the following return an error 1004?

.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""

With Range("weekending")(1, 1)
.Offset(0, (columncount)).Value = monthdate
'assigns weekending date to column heading on Worksheet("vendor_totals")
.Offset(1, (columncount)).Value = Sheets("sheet1").Range("h1").Value
'assigns sq footage value for week
.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""
'assign formula SUM(current column row6: current column row 200)
End With

--
Carl Brehm
Lake Lafourche Bird House
Hebert, LA

Keets, Tiels, GN Lories, Quakers
Mitred Conures, TAG's, Bourkes
Lovebirds, Cherry Head Conures
Prince of Whales

Wholesale Cages to Breeders & Pet Stores
 
C

Carl Brehm

Returns same 1004 not defined error
The other 2 .offset lines work fine.
Is there another way to go about this?

Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""

With Range("weekending")(1, 1)
.Offset(0, (columncount)).Value = monthdate
'assigns weekending date to column heading on Worksheet("vendor_totals")
.Offset(1, (columncount)).Value = Sheets("sheet1").Range("h1").Value
'assigns sq footage value for week
.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""
'assign formula SUM(current column row6: current column row 200)
End With

--
Carl Brehm
Lake Lafourche Bird House
Hebert, LA

Keets, Tiels, GN Lories, Quakers
Mitred Conures, TAG's, Bourkes
Lovebirds, Cherry Head Conures
Prince of Whales

Wholesale Cages to Breeders & Pet Stores
Haven't tested it, but probably because you are using the default value property. Try this

Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount).Address & ":" & .Cells(200, columncount).Address & ")"""

and adjust the other one similarly
 
B

Bob Phillips

I think you have too many quotes. Try this

.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount).Address & ":" & .Cells(200, columncount).Address & ")"


--

HTH

RP
(remove nothere from the email address if mailing direct)


Why does the following return an error 1004?

.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""

With Range("weekending")(1, 1)
.Offset(0, (columncount)).Value = monthdate
'assigns weekending date to column heading on Worksheet("vendor_totals")
.Offset(1, (columncount)).Value = Sheets("sheet1").Range("h1").Value
'assigns sq footage value for week
.Offset(2, (columncount)).Formula = "=SUM(" & .Cells(6, columncount) & ":" & .Cells(200, columncount) & ")"""
'assign formula SUM(current column row6: current column row 200)
End With

--
Carl Brehm
Lake Lafourche Bird House
Hebert, LA

Keets, Tiels, GN Lories, Quakers
Mitred Conures, TAG's, Bourkes
Lovebirds, Cherry Head Conures
Prince of Whales

Wholesale Cages to Breeders & Pet Stores
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Range("Weekending").Cells.Columns.Count 4
Sumif Help needed 3
Formula Help 1
Error 1004 help 4
Function to convert string 13
sum (column 2 of namedrange) 4
Sumif Function Help 1
Help with summing 3

Top