userform

VBA- Using RefEdit for copying range between workbooks

喜夏-厌秋 提交于 2020-06-17 07:18:07
问题 I wanted to copy some not continous ranges from several workbook/ worksheets to a specific sheet. I am using a userform and RefEdit control on that. But the Excel freezs each time I am calling the form and addressing the ranges! I can't do anything except End Excel! Here is my Code. Private Sub CommandButton1_Click() Dim rng As Range Set rng = Range(Me.RefEdit1.Value) rng.Copy ThisWorkbook.Sheets("Transfer").Range("a1").PasteSpecial xlPasteValues End Sub Private Sub UserForm_Activate() For

Gray out items in a Combo Box list after use so users cannot select them

回眸只為那壹抹淺笑 提交于 2020-05-16 03:15:49
问题 I have a project that I am working on for hardware deployment at new locations. I have a userform combo box with a list of IP addresses that will be assigned to certain hardware items(i.e. credit card machines). I am trying to find a way where once one of the IP addresses is selected for use, that the item in the combobox list is either removed or grayed out and the user cannot reuse. But if for some reason the IP comes back available, that the item is now available for use in the list. The

Reference UserForm.TextValue1 from VB code query

我是研究僧i 提交于 2020-04-30 16:31:13
问题 i have a pre-created xlsm workbook that has inside of it some userforms that i'd like to set with values from some VB code. So I can access, open and show the workbook everything is going fine there but I'm having an issue in getting the syntax/terminology correct for interactibg with userforms. my code looks something like this: Dim wb as Object = getworkbook(handle, workbookname) 'i now have a workbook i can manipulate 'here i've left out a series of worksheet calls that happen and some

User Form referencing another sheet Run-time error '1004':

对着背影说爱祢 提交于 2020-02-25 06:00:20
问题 I am trying to get a user form list box to populate the values in a range from another sheet and getting this error. I have spent so much time working on it to no avail. I understand that excel cannot see the referenced sheets "Products" and "Locations", but I don't understand why. Option Explicit Private Sub UserForm_Initialize() Dim LocationsList, ProductsList, Location, Product As Range Set LocationsList = ActiveWorkbook.Sheets("Locations").Range("B2", Range("B2").End(xlDown)) Set

Prevent autorun VBA code when opening a file

对着背影说爱祢 提交于 2020-02-23 03:48:15
问题 I'm facing a problem where I have written a User form where I have provided the application.visible = false in the workbook program sheet under on_open , now I'm able to run the program but I'm unable to open the workbook or the VBA program. Please help Thank you and Regards, Nagarjun B 回答1: To prevent autorun VBA code like Workbook_Open or Auto_Open click File › Open from the menu/ribbon, select your file and hold down the shift key when you click the Open button. For a detailed how-to also

Prevent autorun VBA code when opening a file

…衆ロ難τιáo~ 提交于 2020-02-23 03:48:00
问题 I'm facing a problem where I have written a User form where I have provided the application.visible = false in the workbook program sheet under on_open , now I'm able to run the program but I'm unable to open the workbook or the VBA program. Please help Thank you and Regards, Nagarjun B 回答1: To prevent autorun VBA code like Workbook_Open or Auto_Open click File › Open from the menu/ribbon, select your file and hold down the shift key when you click the Open button. For a detailed how-to also

Prevent autorun VBA code when opening a file

人走茶凉 提交于 2020-02-23 03:46:07
问题 I'm facing a problem where I have written a User form where I have provided the application.visible = false in the workbook program sheet under on_open , now I'm able to run the program but I'm unable to open the workbook or the VBA program. Please help Thank you and Regards, Nagarjun B 回答1: To prevent autorun VBA code like Workbook_Open or Auto_Open click File › Open from the menu/ribbon, select your file and hold down the shift key when you click the Open button. For a detailed how-to also

How to use VBA to read the values of a checkbox from an Excel userform

一世执手 提交于 2020-02-05 01:59:42
问题 I have created a userform that contains two checkboxes. I would like to be able to do different things depending on whether each box is checked or unchecked. However, it seems like no matter what I do, it will always tell me the original value of the checkboxes (false and false). Here is the code attached to clicking CommandButton1: Private Sub CommandButton1_Click() ReadData End Sub And here ReadData: Sub ReadData() Dim myForm As UserForm Set myForm = UserForms.Add("ComplaintEntryForm")

VBA UserForm: Unexpected behaviour after using SetFocus on a TextBox

六月ゝ 毕业季﹏ 提交于 2020-01-30 09:43:27
问题 I have a UserForm that displays the text content of various cells within the active worksheet and has a TextBox to allow users to enter new information. The UF updates automatically whenever the user selects a new cell/range through the Workbook_SheetSelectionChange event. At the end of the UF Update procedure (a public sub within the UF code module) I use TextBoxName.SetFocus (along with .SelStart = .TextLenght) to set the focus on the text box, ready for the user to start typing. Now this

How to fix run time error 424 when accessing the value of a CheckBox in Excel VBA?

时间秒杀一切 提交于 2020-01-26 02:02:25
问题 Okay so here is the problem: In my user form, I have 2 checkboxes. I want to be able to use the value of the checkbox to perform a certain job. Example: Sub main() UserForm1.Show If UserForm1.CheckBox1.Value=True Then MsgBox("Awesome") End If End Sub Now my problem with this is that it keeps giving me run time error 424. Can anyone help me with this? Your help is greatly appreciated. Thank you. Update: Sub main() UserForm1.Show If UserForm1.CheckBox1.Value=True Then Worksheets(1).Activate If