Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default What is wrong with this range???

NextGameCounter, x and y are all integers. GoalieX is defined as an object.
AwayTeamPage is defined as a worksheet and is used several times earlier in
code without any issues.

i get the error message Method 'Range ' of object '_Worksheet' failed. i
don't get it.

For y = 1 To 9
Set GoalieX = AwayTeamPage.Range("GOALIE" & y)
For x = 1 To 3
AwayTeamPage.Range(GoalieX).Cells(4 + NextGameCounter, -3) =
AwayTeamPage.Range("g6").Cells(NextGameCounter, -1 + x)
Next x
Next y
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default What is wrong with this range???

so you have defined names/named ranges Goalie1 to Goalie9

then

For y = 1 To 9
Set GoalieX = AwayTeamPage.Range("GOALIE" & y)
For x = 1 To 3
GoalieX.Cells(4 + NextGameCounter, -3) = _
AwayTeamPage.Range("g6").Cells(NextGameCounter, -1 + x)
Next x
Next y

should work although I don't see NextGameCounter getting changed within your
loop and GoalieX must refer to a location in column D or farther to the
right.

--
Regards,
Tom Ogilvy




"Geoff ML" wrote:

NextGameCounter, x and y are all integers. GoalieX is defined as an object.
AwayTeamPage is defined as a worksheet and is used several times earlier in
code without any issues.

i get the error message Method 'Range ' of object '_Worksheet' failed. i
don't get it.

For y = 1 To 9
Set GoalieX = AwayTeamPage.Range("GOALIE" & y)
For x = 1 To 3
AwayTeamPage.Range(GoalieX).Cells(4 + NextGameCounter, -3) =
AwayTeamPage.Range("g6").Cells(NextGameCounter, -1 + x)
Next x
Next y

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default What is wrong with this range???

thanks a lot
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default What is wrong with this range???

On Jul 7, 7:18*pm, Geoff ML wrote:
NextGameCounter, x and y are all integers. GoalieX is defined as an object.

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
right code, wrong range Ray Excel Programming 2 March 22nd 07 02:13 PM
Range in wrong book Newbie Excel Programming 5 February 8th 07 02:38 PM
VBA Range error - How does this work and what am I doing wrong? UIBC Excel Programming 6 October 15th 06 08:56 PM
User input as a range. What am I doing wrong? Irada Shamilova[_2_] Excel Programming 0 October 26th 04 08:34 AM
deleting wrong range! gavmer[_44_] Excel Programming 3 July 2nd 04 02:08 AM


All times are GMT +1. The time now is 06:25 PM.

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

About Us

"It's about Microsoft Excel"