J
jason
Hi, I'm trying to use Visual Basic to program a macro that
will alter a worksheet (Excel 2000, version 9.0.2720;
Windows 2000.)
But every time the code gets to a place (any place) where
I make use of a range object, the code stops running and a
small popup displays the message, "Visual Basic
\newline 400". Nothing else! Just "400".
I suspect that, since I'm new to VB, I'm not setting up
the objects correctly. Below is sample code (see *** for
where it is 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 eachCellRow As String
Dim eachCellCol As String
Dim cellFormula As String
Dim i, j As Integer
Dim initials As String
Dim cell1, cell2, cell3 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")
*** (here |
v )
myRange.Select
If anyone can help, I would appreciate it very much.
Jason
will alter a worksheet (Excel 2000, version 9.0.2720;
Windows 2000.)
But every time the code gets to a place (any place) where
I make use of a range object, the code stops running and a
small popup displays the message, "Visual Basic
\newline 400". Nothing else! Just "400".
I suspect that, since I'm new to VB, I'm not setting up
the objects correctly. Below is sample code (see *** for
where it is 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 eachCellRow As String
Dim eachCellCol As String
Dim cellFormula As String
Dim i, j As Integer
Dim initials As String
Dim cell1, cell2, cell3 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")
*** (here |
v )
myRange.Select
If anyone can help, I would appreciate it very much.
Jason