Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Range("Weekending").Cells.Columns.Count

Why would
columncount = Range("Weekending").Cells.Columns.Count
return error 1004 (Method rage of object worksheet failed)?

Code is located on sheet1 activated by button
=EMBED("Forms.CommandButton.1","")


Private Sub Start_new_week_Click()
Dim monthdate As String
Dim columncount As Integer

monthdate = Application.InputBox("Week Ending Date", "Date", , , , , , 2)
'gets date of current week ends
Sheets("sheet1").Range("i4").Value = monthdate

Expand_Named_Range "Weekending", "right", 1
'expands named range one column

columncount = Range("Weekending").Cells.Columns.Count
'Counts number of colums in named range

With Range("weekending")
.Offset(0, columncount - 1).Value = monthdate
'assigns weekending date to column heading
'on Worksheet("vendor_totals")
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range("Weekending").Cells.Columns.Count

If you are using xl97, set the takefocus on click property of the command
button to false.

--
Regards,
Tom Ogilvy

"Carl Brehm" wrote in message
...
Why would
columncount = Range("Weekending").Cells.Columns.Count
return error 1004 (Method rage of object worksheet failed)?

Code is located on sheet1 activated by button
=EMBED("Forms.CommandButton.1","")


Private Sub Start_new_week_Click()
Dim monthdate As String
Dim columncount As Integer

monthdate = Application.InputBox("Week Ending Date", "Date", , , , , , 2)
'gets date of current week ends
Sheets("sheet1").Range("i4").Value = monthdate

Expand_Named_Range "Weekending", "right", 1
'expands named range one column

columncount = Range("Weekending").Cells.Columns.Count
'Counts number of colums in named range

With Range("weekending")
.Offset(0, columncount - 1).Value = monthdate
'assigns weekending date to column heading
'on Worksheet("vendor_totals")
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Range("Weekending").Cells.Columns.Count

Using 2000 V9.0.2720
set the takefocus = false
Makes no sense as Expand_Named_Range "Weekending", "right", 1
works fine.
Weekending is a rang on "sheet2"
Function Expand_Named_Range is in a normal basic module,
not in sheet1 code

Carl Brehm
Lake Lafourche Bird House
Hebert, LA

"Tom Ogilvy" wrote in message
...
If you are using xl97, set the takefocus on click property of the command
button to false.

--
Regards,
Tom Ogilvy

"Carl Brehm" wrote in message
...
Why would
columncount = Range("Weekending").Cells.Columns.Count
return error 1004 (Method rage of object worksheet failed)?

Code is located on sheet1 activated by button
=EMBED("Forms.CommandButton.1","")


Private Sub Start_new_week_Click()
Dim monthdate As String
Dim columncount As Integer

monthdate = Application.InputBox("Week Ending Date", "Date", , , , , , 2)
'gets date of current week ends
Sheets("sheet1").Range("i4").Value = monthdate

Expand_Named_Range "Weekending", "right", 1
'expands named range one column

columncount = Range("Weekending").Cells.Columns.Count
'Counts number of colums in named range

With Range("weekending")
.Offset(0, columncount - 1).Value = monthdate
'assigns weekending date to column heading
'on Worksheet("vendor_totals")
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range("Weekending").Cells.Columns.Count

I said if you are using xl97 to change TakeFocusOnClick propery to false.
If you were using xl97 it would make a lot of sense. You didn't say, so I
took a guess.

Your problem is probably that:
Weekending is a rang on "sheet2"

and this code is not in the sheet2 code module. In that case, unlike in a
"normal basic" module you must qualify Range("WeekEnding") like so

worksheets("Sheet2").Range("WeekEnding")

Sorry for the bad guess. It is a popular source of your error message.

--
Regards,
Tom Ogilvy


"Carl Brehm" wrote in message
...
Using 2000 V9.0.2720
set the takefocus = false
Makes no sense as Expand_Named_Range "Weekending", "right", 1
works fine.
Weekending is a rang on "sheet2"
Function Expand_Named_Range is in a normal basic module,
not in sheet1 code

Carl Brehm
Lake Lafourche Bird House
Hebert, LA

"Tom Ogilvy" wrote in message
...
If you are using xl97, set the takefocus on click property of the

command
button to false.

--
Regards,
Tom Ogilvy

"Carl Brehm" wrote in message
...
Why would
columncount = Range("Weekending").Cells.Columns.Count
return error 1004 (Method rage of object worksheet failed)?

Code is located on sheet1 activated by button
=EMBED("Forms.CommandButton.1","")


Private Sub Start_new_week_Click()
Dim monthdate As String
Dim columncount As Integer

monthdate = Application.InputBox("Week Ending Date", "Date", , , , , ,

2)
'gets date of current week ends
Sheets("sheet1").Range("i4").Value = monthdate

Expand_Named_Range "Weekending", "right", 1
'expands named range one column

columncount = Range("Weekending").Cells.Columns.Count
'Counts number of colums in named range

With Range("weekending")
.Offset(0, columncount - 1).Value = monthdate
'assigns weekending date to column heading
'on Worksheet("vendor_totals")
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Range("Weekending").Cells.Columns.Count

Thanks for your help.
I will just move it to a normal module and keep code on a sheet to only what
has to be there.

--
Carl & Linda 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
"Tom Ogilvy" wrote in message
...
I said if you are using xl97 to change TakeFocusOnClick propery to false.
If you were using xl97 it would make a lot of sense. You didn't say, so I
took a guess.

Your problem is probably that:
Weekending is a rang on "sheet2"

and this code is not in the sheet2 code module. In that case, unlike in a
"normal basic" module you must qualify Range("WeekEnding") like so

worksheets("Sheet2").Range("WeekEnding")

Sorry for the bad guess. It is a popular source of your error message.

--
Regards,
Tom Ogilvy


"Carl Brehm" wrote in message
...
Using 2000 V9.0.2720
set the takefocus = false
Makes no sense as Expand_Named_Range "Weekending", "right", 1
works fine.
Weekending is a rang on "sheet2"
Function Expand_Named_Range is in a normal basic module,
not in sheet1 code

Carl Brehm
Lake Lafourche Bird House
Hebert, LA

"Tom Ogilvy" wrote in message
...
If you are using xl97, set the takefocus on click property of the

command
button to false.

--
Regards,
Tom Ogilvy

"Carl Brehm" wrote in message
...
Why would
columncount = Range("Weekending").Cells.Columns.Count
return error 1004 (Method rage of object worksheet failed)?

Code is located on sheet1 activated by button
=EMBED("Forms.CommandButton.1","")


Private Sub Start_new_week_Click()
Dim monthdate As String
Dim columncount As Integer

monthdate = Application.InputBox("Week Ending Date", "Date", , , , , ,

2)
'gets date of current week ends
Sheets("sheet1").Range("i4").Value = monthdate

Expand_Named_Range "Weekending", "right", 1
'expands named range one column

columncount = Range("Weekending").Cells.Columns.Count
'Counts number of colums in named range

With Range("weekending")
.Offset(0, columncount - 1).Value = monthdate
'assigns weekending date to column heading
'on Worksheet("vendor_totals")
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








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count the number of cells that conatin a "." in a range Jonathan Brown Excel Worksheet Functions 5 February 5th 09 11:00 PM
Possible to "rotate" range of cells so columns are rows and vice versa? [email protected] New Users to Excel 3 January 5th 07 05:21 PM
Count cells that contain "Y" in columnA IF contains"X" in columnB holliedavis Excel Worksheet Functions 6 July 20th 06 06:12 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"