I am having multiple problems:
I created an if statement that first clears out any pre-existing content and then adds new data to the cells from a Userform. The Userform has 5 tabs within a Multipage and when I set the first page as active I want the data to be exported into a BOM. I have a specific sheet called BOM.
Problem 1: When I test out this code it will clear the contents, but it stops there and skips over the rest.
Problem 2: If i a rem out the clear contents it will write the 3 that I told it too, but If I re run it it will only write to the "B2" cell value and everything else is skipped over.
Problem 3: I have to manually clear out the contents to get all the 3 items to work again.
I don't know if this matters or not, but I noticed that when the code has failed the userform closes out automatically. When it writes all 3 items the userform stays up and works fine until I close it.
What am I doing that would cause this sort of behavior?
I created an if statement that first clears out any pre-existing content and then adds new data to the cells from a Userform. The Userform has 5 tabs within a Multipage and when I set the first page as active I want the data to be exported into a BOM. I have a specific sheet called BOM.
Problem 1: When I test out this code it will clear the contents, but it stops there and skips over the rest.
Problem 2: If i a rem out the clear contents it will write the 3 that I told it too, but If I re run it it will only write to the "B2" cell value and everything else is skipped over.
Problem 3: I have to manually clear out the contents to get all the 3 items to work again.
I don't know if this matters or not, but I noticed that when the code has failed the userform closes out automatically. When it writes all 3 items the userform stays up and works fine until I close it.
What am I doing that would cause this sort of behavior?
Code:
Private Sub CommandButton2_Click()
If MultiPage1.Value = 0 Then
Worksheets("BOM").Range("B2:E77").ClearContents
ThisWorkbook.Worksheets("BOM").Range("B2").Value = ComboBox14
ThisWorkbook.Worksheets("BOM").Range("C2").Value = TextBox111
ThisWorkbook.Worksheets("BOM").Range("D2").Value = TextBox115
End If
End Sub