LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default STUPID range object error

Public Sub Copy_2_Cohort()

Set wsCohort = wb.Worksheets("CohortList")
iCohortRow = wsCohort.Cells(5000, 2).End(xlUp).Offset(1, 0).Row
Set rCohortStudent = wsCohort.Range("b" & iCohortRow)
Set rClass = wsCohort.Range("a" & iCohortRow)

rCohortStudent = sStudent
rClass = sClass

End Sub

============================
all variables are dimmed as indicated in a global variables module.

there's no reason (that i can see) why this doesn't work! half of the
time it runs through, but either rCohortStudent or rClass is left
blank (when the intellisense & various test messageboxes give the
correct range.address & text). the other half of the time it breaks
on either rCohortStudent OR rClass being unidentified objects. when
it was rClass that was left blank, i tried

Set rClass = rCohortStudent.Offset(0,-1)

that worked once, but then started breaking an error - saying object
wasn't set (when intellisense showed that rCohortStudent WAS set,
properly!).

i tried setting these ranges as variants (vClass), but that didn't
work.

i've compared these statements to working statements in other subs,
and i don't see what the problem is!

this is part of a huge, ungainly macro, so i thought perhaps since it
broke out of code an application.enableevents (or something) hadn't
been reset to true, so i ran another sub:

Sub reset_everything()
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.DataEntryMode = True
End Sub

didn't help.

at this point i am considering reworking the structure of the macros &
modules so they flow better (more in order rather than go-over-here,
go-over-there).

any ideas?
thanks a lot!
susan

 
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
Range Object error NoSoupForYou Excel Programming 9 October 26th 06 01:46 AM
peculiar error with Range() object Jeff[_42_] Excel Programming 2 July 2nd 06 09:36 PM
error 1004 Range object Tony James[_2_] Excel Programming 3 December 19th 05 03:11 PM
Error inserting formulas into a range object Josh22[_3_] Excel Programming 1 August 4th 05 11:55 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM


All times are GMT +1. The time now is 12:24 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"