Range question

JessyVal

New Member
Joined
Feb 23, 2021
Messages
29
Office Version
  1. 365
Hi, I have a question, I hope I can explain my self clearly

I have a form called userform1, this form is to show information about people , I can find them by id or by name, I can modify information from that form. As you can see, beside volunteer name box, there are two search buttons, if you click in the second search button a second user form is going to be displayed.

1618836162302.png
1618831669356.png



This is the second form, the porpuse of this second form is that in case the user is not sure about the id, or there are many people with the same name, he can pick which register is the one that he wants to update. The main idea is that the user click in the id, then click in Modificar (modify) and what I spected is that the first User form will be displayed with the info of the person that the user want to modify.

1618831758291.png


The issue that I am having now, is that once I click in the id and then press modificiar I got this error

1618831975674.png



this is the code that i have in the buttom Modificar (modify)

Private Sub CommandButton3_Click()
If Me.ListBox1.ListIndex < 0 Then
MsgBox "You haven't selected any record"
Else
UserForm1.Show
End If

End Sub

I hope I was able to explain myself
 

Attachments

  • 1618836153312.png
    1618836153312.png
    31.2 KB · Views: 1

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,507
Office Version
  1. 365
Platform
  1. Windows
You are getting that error because you have a "." in front of the word "Range" in ".Range("A1")".
Remove this period. You would only use ".Range" within a "With" clause, which you are not.
If it is not within a "With" clause, it would just be "Range"
 

JessyVal

New Member
Joined
Feb 23, 2021
Messages
29
Office Version
  1. 365
You are getting that error because you have a "." in front of the word "Range" in ".Range("A1")".
Remove this period. You would only use ".Range" within a "With" clause, which you are not.
If it is not within a "With" clause, it would just be "Range"
It works! thankyou so much!
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,507
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
Glad I was able to help!
:)
 

JessyVal

New Member
Joined
Feb 23, 2021
Messages
29
Office Version
  1. 365
You are welcome.
Glad I was able to help!
:)
Hi Sorry, I dont't know why if I run the form from vba works well, but If I try to excecute from the excel sheet, I got an error

1618910741642.png
1618910770864.png
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,563
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It means that your form is already displayed, so you can't show it again.

This is also a different question really and should be posted as such.
 

Forum statistics

Threads
1,144,515
Messages
5,724,814
Members
422,579
Latest member
parsnipsnatcher

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
Top