Reputation: 51
So my boss needs me to Error Check a Form. When you click on the button the user should be in the first column before adding any information, if not then it needs to display an error message telling them that they need to be in the first column before getting started. We have been using ActiveCell.Offset to insert data automatically and if you start in any other column besides the first one, the information is off by one cell.
Here is my error code for this. This code is in the form itself and I need to call it in the module that is required for this program. Any help wold be greatly appreciated.
Public Sub Error_Check()
If Not Range(A1, [A1,048,576]) Then
MsgBox ("Please make sure you are in the Product Attribute Set column before proceeding.")
Else
ConfigGroup.Show
End If
End Sub
Upvotes: 0
Views: 422
Reputation: 970
I see two possible solutions.
Instead of the code referencing the active cell, reference the first column, i.e. SheetName.Columns(1)
If you prefer to keep the code based off of ActiveCell.Offset
, why not have the macro select a cell in the first column for the user? For example, insert Cells(1,1).Select
at the beginning of your code.
Upvotes: 1