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

i haven't had a chance to test it, but working on another sub it hit
me.

rCohortStudent = sStudent
rClass = sClass

should be

rCohortStudent.Value = sStudent
rClass.Value = sClass

duh.
susan


On May 8, 10:45 am, Susan wrote:
waaaaaay back in a beginning userform sub....

Public Sub cmdStart_click()

Set ws = ActiveSheet
Set wb = ActiveWorkbook

it's not released anywhere (i just double-checked).
wb always refers to this main workbook that holds the userforms & all
the code. anything else that's opened is set as newWB. i could try
setting it again, tho.... it wouldn't hurt. or i could throw in a
testing

msgbox wb.name

to check it out. although if that was wrong,

Set wsCohort = wb.Worksheets("CohortList")

wouldn't work, either.

sStudent & sClass are set somewhere else, too, but the intellisense
shows the correct text for each of the strings.

thanks for any ideas/suggestions/hari-kari methods!!!
:)
susan

On May 8, 10:19 am, "Gary Keramidas" <GKeramidasATmsn.com wrote:



where is wb dimmed?


--


Gary


"Susan" wrote in message


roups.com...


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- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



 
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 06:51 AM.

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"