strange Unspecified Error on userform when run 2007 version

Abdo

Board Regular
Joined
May 16, 2022
Messages
183
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hi Guys,
I'm not sure why shows Unspecified Error :unsure: when try run the form on 2007 version and when close the file and run gain the error doesn't show , but shows from time another time !
when debug the error will stop on UserForm1.Show and try use F8 it keep in this line UserForm1.Show
I'm not sure what's the problem!:rolleyes:
here is the code
VBA Code:
Private Sub CommandButton1_Click()
Dim LR As Long
Dim ws As Worksheet

Set ws = Sheets("GOODS")
With ws
    ' determine last used cell in column B
    LR = .Range("B" & .Rows.Count).End(xlUp).Row
[B]    
    .[/B]Rows(LR - 1).Insert xlShiftDown, xlFormatFromLeftOrAbove
    .Rows(LR - 1).Value = .Rows(LR).Value
    ' copy UserForm values to last row
    .Range("B" & LR) = Date
    .Range("C" & LR) = TextBox1.Text
    .Range("D" & LR) = TextBox2.Text
    .Range("E" & LR) = TextBox3.Text
    .Range("F" & LR) = TextBox4.Text
End With
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""

End Sub
any opinions guys?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
based on what i see you have a and in your code

line should be


VBA Code:
.Rows(LR - 1).Insert xlShiftDown, xlFormatFromLeftOrAbove
 
Upvote 0
i dont kn what happened in previous message but it should be the square bracket B and square bracket /B removed
 
Upvote 0
#rabsofty I think the B etc has to do with formatting posts on the forum. #Abdo, I don't see any Userform1>show lines of code in your post? I would suggest that you specify your textboxes (ie. Userform1.TextBox1.Text) but I'm guessing your real problem for the crash is in either the activation and/or initialization userform event code(s). HTH. Dave
 
Upvote 0
i dont kn what happened in previous message but it should be the square bracket B and square bracket /B removed
no no ! & sorry about it , I no know how add the square bracket B and square bracket /B when I use vba icon !
it's not existed in my code .
 
Upvote 0
I don't see any Userform1>show lines of code in your post?
because the button is inside the sheet when show the userfrom .I thought is not important to post it to , sorry !
but I'm guessing your real problem for the crash is in either the activation and/or initialization userform event code(s).
me too, but the debug keep in UserForm1.Show
but what confuse me why sometimes work without any error and why work in the others versions without any error ?!!!
 
Upvote 0
XL is a funny thing and trying to get VBA to work across versions is often challenging. When there is a problem in the Userform activation or initializiation event codes, XL will debug the error to the Userform.Show line of code. If there is any Userform activation and/or initialize code, post it and maybe we can identify the problem. Dave
 
Upvote 0
If there is any Userform activation and/or initialize code, post it and maybe we can identify the problem. Dave
no, just this I don't post it .
VBA Code:
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
 
Upvote 0
No initialize or activate code. What controls do you have on the userform (ie. textboxes, etc.)? Do they have their row source(s) set? Dave
 
Upvote 0
just four textboxes as in code and commandbutton1 . there is no totally any code initialize or activate for userform.
 
Upvote 0

Forum statistics

Threads
1,214,655
Messages
6,120,760
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top