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: 39
Default Cannot use range objects

Hi, I'm trying to use VB to alter one worksheet based on a
roster of names in another worksheet (in the same
workbook). I'm using Excel 2000 version 9.0.2720 (Windows
2000) and Visual Basic 6.0.8435.

Each time the code gets to a place (any place) where it is
using a range, the code stops executing and VB reports the
following: "Visual Basic 400". Nothing else! Just -
"400."

I suspect that, since I'm new to VB, I'm not setting
things up correctly. Here is a typical function (see ***
for the line where things are breaking down):

Private Sub addNewList(ByVal numEmpl As Integer)

Dim mySheetName As String
Dim mySheet As Worksheet
Dim myRange As Range

Dim numOfWeeks As Integer
Dim numOfShifts As Integer
Dim baseCell As Range
Dim cellFormula As String
Dim initials As String

'Initialize variables
mySheetName = Worksheets("ROSTER").Range("E7").Value
Set mySheet = Worksheets(mySheetName)
numOfWeeks = Worksheets("Roster").Range("E10").Value
numOfShifts = numOfWeeks * 17

'Get to our starting point
mySheet.Select
Set myRange = Range("B5")
*** myRange.Select

If anyone can help, I would greatly appreciate it.
 
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
Could not load objects srkg123 Excel Discussion (Misc queries) 0 April 27th 08 11:14 PM
OLE Objects [email protected] Excel Discussion (Misc queries) 0 March 7th 08 09:44 PM
using the address properties from range objects in a sum formula JEFFWI Excel Discussion (Misc queries) 2 September 11th 07 05:36 AM
Embedded Objects Lightfoot Excel Discussion (Misc queries) 0 December 30th 05 02:20 PM
VBA Objects Kevin Excel Discussion (Misc queries) 8 January 1st 05 09:07 PM


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