I am working on building a UserForm to enter data into an Excel sheet. I have created the UserForm, named all my controls and objects. I am now coding what should happen when the Submit button is clicked. The first thing to do is to declare my variables, right? I have created all the SUBs I will need (one for each object and filled with just comments at this point). So, I go to work on the first SUB and I get this error and it highlights my first object's variable name.
Compile error: Member already exists in an object module from which this object module derives
So I comment out the DIM statements and I get this error and it highlights the first object's variable name the first time it's used.
Compile error: Invalid use of property
I am stuck! I understand that there is possibly a circular reference somewhere but I just don't see it.
If anyone can help, it would be greatly appreciated! This is the biggest project I have ever attempted and I am sure I will have more questions down the road.
Thank you,
CWMacNut
Graphics Engineer
Compile error: Member already exists in an object module from which this object module derives
So I comment out the DIM statements and I get this error and it highlights the first object's variable name the first time it's used.
Compile error: Invalid use of property
I am stuck! I understand that there is possibly a circular reference somewhere but I just don't see it.
Code:
Dim CurrentWorksheet$
Dim HeaderCount%
Dim HeaderNames As Variant
Dim LastCell As Range
Dim FirstBlankCell As Range
'Dim JobNumNEW$
'Dim PRINTERS$
'Dim TodaysDate$
'Dim Time_Start$
'Dim Time_End$
'Dim Time_Total$
'Dim Duplex_YES$
'Dim Duplex_NO$
'Dim NumPrints$
'Dim Color_YES$
'Dim Color_NO$
Private Sub Button_Submit_Click()
CurrentWorksheet = ActiveSheet.Name
Range("A1").Select
' ================ clear all variables
Set JobNumNEW = ""
Set PRINTERS = ""
Set TodaysDate = ""
Set Time_Start = ""
Set Time_End = ""
Set Time_Total = ""
Set Duplex_YES = ""
Set Duplex_NO = ""
Set NumPrints = ""
Set Color_YES = ""
Set Color_NO = ""
' ================ populate HeaderNames
HeaderCount = Range(Selection, Selection.End(xlToRight)).Count
HeaderNames = Application.Index(Range("A1", Range("A1").End(xlToRight)).Value, 1, 0)
' ================ determine LastCell & FirstBlankCell
Range("A3").End(xlDown).Select
Set LastCell = Application.Selection
ActiveCell.Offset(1, 0).Select
Set FirstBlankCell = Application.Selection
MsgBox ("Last cell is: " & LastCell & " . First blank cell is: " & FirstBlankCell & " .")
' ================
' JobNum() called
' ================
[COLOR=#ff0000][B]intentional break in code (irrelevant)[/B][/COLOR]
' ================
Sub JobNum()
' What to do with the job number entered goes here
' Name: JobNumNEW
a = 1 ' ("A1")
For a = 1 To HeaderCount
If HeaderNames(a) = "Job #" Then...
If anyone can help, it would be greatly appreciated! This is the biggest project I have ever attempted and I am sure I will have more questions down the road.
Thank you,
CWMacNut
Graphics Engineer