Free Microsoft Excel 2013 Quick Reference

Data from textbox in userform into worksheet Results

I have a userform with a textbox where data can be entered. I want this data to then enter itself into a cell specified within the worksheet.

I do not want to use the control source function to do this for various reasons.

Look forward to a reply, many thanks.

I have userform 1 with textboxe "name" and buttons. one of the buttoms is called "remove" when this button is clicked it brings up userforms 2. On this form i have the same textbox as userform 1 "name" but with a checkbox beside the textbox.

What i am attempting is for the user click remove button on userform 1, which will bring up userform2. now they will check the field "name" from userform 2 (as the data show in the textbox "name" will be linked to "name" in userform 1 therefore data will be the same) which they want removed and then click the button remove on userform 2 which will clear the textbox which is shown on both userform 1 and 2.

I want it to clear that textbox so when they click close, the data is no longer be in there.

So basically i need to know how to:
check checkbox to clear textbox in userform2
Link the textboxes in userform 1 and 2 so when data is removed from userform 2 it will also romove from same textbox -"name" in userform1

And finally: the textbox from userform1, enters data into a specified cell on worksheet called "details1" now i want it so when i click remove on userform2, it will remove the particular textbox data from the cell which is linked to the same box in userform1

I hope this makes some kind of sense...thanks

Hello All,

I've searched the forums for an answer to my problem and can not find it. And please bear with me, I am a complete newbie. I'm a credit analyst and am looking for a way to simplify my job.

Is there a way to copy entries from multiple textboxes in a userform to a clipboard so that they can be pasted into another application?

It seemed pretty easy at 1st. The gentleman at this website seems to have an answer but I keep getting a 424 error when assigning his code to a command button w/no changes. I just wanted to see if it worked: http://www.cpearson.com/excel/Clipboard.aspx
  
    Dim DataObj As New MSForms.DataObject
    Dim S1 As String
    Dim S2 As String
    S1 = "text string one"
    S2 = "text string two"
    With DataObj
        .SetText S1, "FormatId1"
        .PutInClipboard
        .SetText S2, "FormatId2"
        .PutInClipboard
        S1 = vbNullString
        S2 = vbNullString
        .GetFromClipboard
        S1 = .GetText("FormatId1")
        S2 = .GetText("FormatId2")
    End With
    Debug.Print S1
    Debug.Print S2
I was able to steal code from various sources to get what I needed in simple form (pasting the userform data to a worksheet and clearing the userform), but this is killing me. Help!

BTW, I uploaded what I have so far. I don't think anyone wants to see it or needs to just yet, but I didn't want to get slammed. It's not Mona Lisa, but in the end I hope it will be.

I'd be very grateful if someone could help me write the code to save the data from the userform into the worksheet with the details below :

The userform has 5 comboBox , 3 TextBox and 2 buttons Submit and Cancel

ComboBox 1 is to choose the name, corresponding to ranges C5:C35 in the worksheet

ComboBox 2 is to choose the week number (columns E4:T4 in worksheet)

Combo Box 3, 4 , 5 are to choose the project's name (B5:B35)

3 Textbox are to enter the number of hours spent for the project corresponding to the choice in Combo Box 3, 4 and 5. So Textbox mus be numbers only.

Note that there are more than one person for one project and one person can do more than one project. So comboBox 4 or 5 can be blank.

I have written the code of the userform but failed to write the module code

Could anyone help me to write the Submit_button_click code please

Thanks a lot for any help

Hi Everyone,

First off I am new to VB for excel, most everything I need to do is just done with excel.

I am running into a problem. I am trying to create a Userform to make User input easier because my spreadsheet is so long and intensive.

I created Userform1 and My Textbox1 pulls a Report # from the Daily Mud Report Tab. I need all my textboxes to Use this number to lookup the Report # in the Mud Checks Tab Column A, then populate the other text boxes accordingly. The problem I think I am facing is that the Textbox 1 and textbox 2 are outside of the multipage control. I need these outside of the multipage control so users do not have to reenter a report number and date for all 4 of the multipage tabs. Each Multipage tab is supposed to be the same report number, but pulling data from different columns since we have 4 reports in any one day. Mud Check 2 In pulls data from "Mud Checks"range A:AL, then the next mud check 2 in further down the spreadsheet.

I thought using a controlsource property would work at first but it is only good for one cell or range. Then I tried writing the code out in VB

Similiar to this. But it doesn't pull into the multipage form.

What would be the best way to have these pull from a VLookup and still be able to update the corresponding cells in the
worksheet on text change or button click?

Hi All,

I have a bit of a perplexing issue.

I have a userform with 36 textboxes for data input.

5 of the textboxes are used to input dates in the format(DD/MM/YYYY) the remainder of the textboxes are used to input values or text.

The data from the userform (textboxes) is transfered to a worksheet by the op pressing a command button.

This seemed to be working fine until this morning when now for some reason the date although still being entred into

testboxes in the correct format (DD/MM/YYYY) is displaying in the spreadsheet as (MM/DD/YYYY)

I have not changed any coed associated with the textboxes so I am stumped as to why this may have happened.

Can any one help?

The coded used to populate the sppread sheet from the text boxes is:


	VB:
	
 CommandButton1_Click() 
     
    Dim iRow As Long 
    Dim ws As Worksheet 
    Set ws = Worksheets("Sheet1") 
     'find first empty row in database
    iRow = ws.Cells(Rows.Count, 1) _ 
    .End(xlUp).Offset(1, 0).Row 'first number = number of rows from top of spread sheet data will be inserted
     
    Dim x As Integer ' Will Transfer data from textboxes to sheet
    For x = 1 To 36 'Numbers of textboxes
        ws.Cells(iRow, x + 1).Value = Me.Controls("Textbox" & x).Value 'the +1 means input will start from column 2(B)
    Next x 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines

Any help in what may be causing this would be mucha appreciated.

Thanks Craig

I have a userForm to add holiday record into this worksheet. UserForm has one comboBox (userIDList) to search userID from ='Jan-July'!empName1 which is from A11 (named Range as empName1). I am trying to add holiday details ( I mean the dates) in column T to CA ROW as per userID.

I do not have any clue how could I pass the data (Holiday dates) from user form to the worksheet. Columns T10:ca10 titles are dated (01/01/2008,02/01/2008..... 29/02/2008)

Do I have to use find or Select CASE.

At the moment I can locate empolyee as per userID and then select the row. I have attached the xl file.

	VB:
	
 addButton_Click() 
     
    Dim sfind  As String 
    Dim cl     As Range 
    Dim fromDate, toDate As Date 
     
     'check for a value & show message
     
    Sheet = "JanJuly" 
    Sheets(Sheet).Select 
     
    Application.ScreenUpdating = False 
     
    If Me.userIDList.Value = "" Then 'the textbox in userform
         
        Me.userIDList.SetFocus 
         
        Exit Sub 
    Else 
        sfind = Me.userIDList.Value 
        With Range("A1", Range("a65536").End(xlUp)) 
            Set cl = .Find(sfind, LookIn:=xlValues) 
            If Not cl Is Nothing Then 
                cl.EntireRow.Select 
                 ' select the entire row for a Employee as per User ID
                 
                 
                 '>>>>>>>>>>>>>>>>>>>>>>>>>
                 'Select Case fromDate
                 
                 'Case 1
                 
                 'Case 2
                 
                 'End Select
                 
                 '
                 
                 '---------------------------------
            Else 
                 
                MsgBox sfind & " does not exist" 
                 
            End If 
             
        End With 
         
    End If 
     
    Unload Me 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


Hello,

I have been working on my spreadsheet for sometime now, so far when I run into a code problem I can figure it out using someone eles's post. However, I can't seem to figure this one out. I need to send data from a userform to specific cells on my spreadsheet based upon the users selection in combobox 1, and textbox 1.
Example: User selects customer name from Combobox1, and part number auto loads into textbox1 from the data sheet.
There are then 11 combobox's that can be clicked as the userform is updated. Once the user is finished, I need the answers from each combobox to transfer to the worksheet next to the referenced Combobox1 and textobox1.
Chris OK had a similar problem, I used the code that RoyUk posted to him, but have only been able to get the first combobox to copy to the sheet, the rest stay blank.
I am new at VB and am sure there is something I am missing. Any ideas would be greatly appreciated.

(Here is the code so far)


	VB:
	
 CommandButton2_Click() 
    Dim ce As Range, srcRng As Range 
    Dim sYear As String, sMonth As String 
     
    sYear = UserForm3.ComboBox1.Text 'When combobox1 is loaded, use as reference#1
    sMonth = UserForm3.TextBox1.Text 'When textbox1 is loades, use as reference #2
    Set srcRng = Range("c2", Range("c65536").End(xlUp)) 'Search range on worksheet
    For Each ce In srcRng 
        If ce.Value = sYear And ce.Offset(0, 2).Value = sMonth Then 'Finds both references on worksheet
            ce.Offset(0, 6).Select 'finds the cell next to the reference, inserts combobox or textbox value
            Selection = ComboBox3.Text 
            ce.Offset(0, 8).Select 
            Selection = ComboBox4.Text 
            ce.Offset(0, 10).Select 
            Selection = ComboBox5.Text 
            ce.Offset(0, 12).Select 
            Selection = ComboBox6.Text 
            ce.Offset(0, 14).Select 
            Selection = ComboBox7.Text 
            ce.Offset(0, 16).Select 
            Selection = ComboBox8.Text 
            ce.Offset(0, 18).Select 
            Selection = ComboBox9.Text 
            ce.Offset(0, 20).Select 
            Selection = ComboBox10.Text 
            ce.Offset(0, 22).Select 
            Selection = TextBox5.Text 
            ce.Offset(0, 23).Select 
            Selection = ComboBox11.Text 
            ce.Offset(0, 25).Select 
            Selection = ComboBox12.Text 
        End If 
    Next ce 
    UserForm3.Hide 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


Good evening,

I'm trying to move data from textboxes into Userform, but the following code
doesn't work (I've tried many variations to no avail). What am I doing wrong?

With Worksheets("Sheet1")
Range("A1").Select
If ActiveCell.Offset(1, 0) = "" Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.End(xlDown).Offset(1, 0).Select
End If
Set rng = ActiveCell
With rng
i = 1
For Each ctrl In Me.Controls
If TypeOf ctrl Is msForms.TextBox Then<----Runtime error 451
.Offset(0, i).Value = ctrl(i).Value
i = i + 1
End If
Next ctrl
End With
End With

Hi

I want a userforn to search for and get data from multiple cells on the same
row of a closed worksheet. Then display the data on the userform, in a
number of labels/textboxes, for the user to review (and if requried, enter
on the active worksheet by the click of a command button). Now the entering
to the active worksheet I can do but its getting the data from the closed
workbook where I am struggling.

Can anyone give me some ideas on how to do this?

Upto now I have been using vlookup to find and enter the data in the active
worksheet and then we delete it if not needed. But with a vlookup in 18
columns this can be a pain. Below are some of the 'vlookups' I use, is there
an easy way to put this same functionality into a userform?

'=VLOOKUP(A15,'J:rev_accs[CSPost2003.xls]CBNW'!$1:$65536,2,FALSE)'

'=VLOOKUP(A15,'J:rev_accs[CSPost2003.xls]CBNW'!$1:$65536,12,FALSE)'

Kind Regards and thanks in advance for any help

Hi

I want a userforn to search for and get data from multiple cells on the same
row of a closed worksheet. Then display the data on the userform, in a
number of labels/textboxes, for the user to review (and if requried, enter
on the active worksheet by the click of a command button). Now the entering
to the active worksheet I can do but its getting the data from the closed
workbook where I am struggling.

Can anyone give me some ideas on how to do this?

Upto now I have been using vlookup to find and enter the data in the active
worksheet and then we delete it if not needed. But with a vlookup in 18
columns this can be a pain. Below are some of the 'vlookups' I use, is there
an easy way to put this same functionality into a userform?

'=VLOOKUP(A15,'J:rev_accs[CSPost2003.xls]CBNW'!$1:$65536,2,FALSE)'

'=VLOOKUP(A15,'J:rev_accs[CSPost2003.xls]CBNW'!$1:$65536,12,FALSE)'

Kind Regards and thanks in advance for any help

Hey guys!

So my goal in this project is to create a userform that retrieves from the worksheet and also allows users to input data themselves from the userform and into an one column listbox on the userform. When the user is done entering in the data, the data is sent into the cell of their choosing (they enter in the row # themselves and it will always be column H), and creates a drop down list of the data they entered.

So far, I have created the userform and with retrieve, erase a line from the listbox, and a "complete& close" buttons. I also have the listbox and the textboxes made. The "complete & close" button is where i look to transfer the data from the listbox from the userform into the drop down list.

I'm not actually sure if this is possible, so I have been working my way around this problem. What I have now is that the listbox data transfers to a useless column on the worksheet in hopes to use that as the range for the drop-down lists. Unfortunately, I just realized that this would probably not work because the drop-down lists would change with the data in this column. Is there a way to make it so that once these drop-down lists are made, they no longer depend on the range and do not alter until the userform calls upon that particular cell again?

I know this is a complicated problem, but please ask for you guys to help! I'm pretty much a novice in VBA and I don't completely understand the limitations of Excel VBA. Help would be much appreciated for this problem that has been giving me headaches for days.

Thanks!

Hi folks,

here's my new dilema!

I have a userform which has 4 criteria at the top that filters data.

from that data i get a reference number and that is automatically placed into a cell.

that is then used to do a Vlookup and these lookups then complete the userform textboxes.

however if i change the filter it doesn't update the textboxes?

here's my code:

Private Sub CmdFilter_Click()

Dim Sprod As String
If FrmNew.CBProduct.Value = "Electricity" Then
Sprod = "E"
ElseIf FrmNew.CBProduct.Value = "Gas" Then
Sprod = "G"
End If

Application.ScreenUpdating = True
'select worksheet dependant on account type
    If FrmNew.CBAccType.Value = "Touched" Then
        Worksheets("Touched Work").Select
    ElseIf FrmNew.CBAccType.Value = "Dayfiled" Then
        Worksheets("Dayfiled").Select
    End If
'filter data by product
    If FrmNew.CBProduct.Value = "Electricity" Then
        Selection.AutoFilter Field:=13, Criteria1:="E"
    ElseIf FrmNew.CBProduct.Value = "Gas" Then
        Selection.AutoFilter Field:=13, Criteria1:="G"
    End If
'filter remaining data by age
    If FrmNew.CBAccAge.Value = "Oldest" Then
    Range("AT1").Select
    Range("A1:CN7707").Sort Key1:=Range("AT1"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    ElseIf FrmNew.CBAccAge.Value = "Newest" Then
    Range("AT1").Select
    Range("A1:CN7707").Sort Key1:=Range("AT1"), Order1:=xlAscending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    End If
    
'filter by billing type
    If FrmNew.CBBilling.Value = "Monthly" Then
        Selection.AutoFilter Field:=33, Criteria1:="Monthly"
    ElseIf FrmNew.CBBilling.Value = "Quarterly" Then
        Selection.AutoFilter Field:=33, Criteria1:="Quarterly"
    End If
    
'select which sheet to pull the data from
    If FrmNew.CBAccType.Value = "Touched" Then
        Worksheets("Touched work").Select
    ElseIf FrmNew.CBAccType.Value = "Dayfiled" Then
        Worksheets("Dayfiled").Select
    End If
    
    Range("E2").Select
        Do Until ActiveCell.Offset(0, 8).Value = Sprod
        ActiveCell.Offset(1, 0).Select
        Loop
        Application.ScreenUpdating = True
            Worksheets("Cover").Range("A6").Value = ActiveCell.Offset(0, 3).Value 'Bill Status
            Worksheets("Cover").Range("A8").Value = ActiveCell.Offset(0, 1).Value 'New Flag
            Worksheets("Cover").Range("A10").Value = ActiveCell.Offset(0, 65).Value ' Port Rec
            Worksheets("Cover").Range("A12").Value = ActiveCell.Offset(0, 68).Value ' Unbilled Value
            Worksheets("Cover").Range("A14").Value = ActiveCell.Offset(0, 20).Value ' Company Name
            Worksheets("Cover").Range("A16").Value = ActiveCell.Offset(0, 66).Value ' Unbilled Reason
            Worksheets("Cover").Range("A4").Value = ActiveCell.Value
'add the data into the userform
            Worksheets("Cover").Range("A2").Value = FrmNew.CBAccType.Value
            
            FrmNew.TxtCRN.Value = Worksheets("Cover").Range("A4").Value
            FrmNew.TxtBillStatus.Value = Worksheets("Cover").Range("A6").Value
            FrmNew.TxtFlag.Value = Worksheets("Cover").Range("A8").Value
            FrmNew.TxtPRec.Value = Worksheets("Cover").Range("A10").Value
            FrmNew.TxtUnVal.Value = Worksheets("Cover").Range("A12").Value
            FrmNew.TxtCname.Value = Worksheets("Cover").Range("A14").Value
            FrmNew.TxtReason.Value = Worksheets("Cover").Range("A16").Value

        Worksheets("Cover").Activate
End Sub

Private Sub UserForm_Initialize()

FrmNew.CBAccType.AddItem "Touched"
FrmNew.CBAccType.AddItem "Dayfiled"

FrmNew.CBProduct.AddItem "Electricity"
FrmNew.CBProduct.AddItem "Gas"

FrmNew.CBAccAge.AddItem "Oldest"
FrmNew.CBAccAge.AddItem "Newest"

FrmNew.CBRoot.AddItem "BER Amendment"
FrmNew.CBRoot.AddItem "Cross License Tranfer"
FrmNew.CBRoot.AddItem "Crossed MTR"
FrmNew.CBRoot.AddItem "Datafix"
FrmNew.CBRoot.AddItem "De-aggregation Issue"
FrmNew.CBRoot.AddItem "Demolition"
FrmNew.CBRoot.AddItem "Duplicate"
FrmNew.CBRoot.AddItem "EP Mismatch"
FrmNew.CBRoot.AddItem "ET"
FrmNew.CBRoot.AddItem "GUTO Issue"
FrmNew.CBRoot.AddItem "Isolation Issue"
FrmNew.CBRoot.AddItem "Late Set Up"
FrmNew.CBRoot.AddItem "Metering issue/Dispute"
FrmNew.CBRoot.AddItem "Migration Issue"
FrmNew.CBRoot.AddItem "New Connection"
FrmNew.CBRoot.AddItem "Portfolio Rec"
FrmNew.CBRoot.AddItem "Registration Issue"
FrmNew.CBRoot.AddItem "Script Errors"
FrmNew.CBRoot.AddItem "Split Accounts"
FrmNew.CBRoot.AddItem "Unoccupied Account"
FrmNew.CBRoot.AddItem "Unsupported Meter"

FrmNew.CBBilling.AddItem "Monthly"
FrmNew.CBBilling.AddItem "Quarterly"

Dim lpbuff As String * 25
Dim ret As Long
Dim StrName As String
Dim StrSheet As String
StrSheet = FrmNew.CBAccType.Value
ret = GetUserName(lpbuff, 25)
StrName = Left(lpbuff, InStr(lpbuff, Chr(0)) - 1)
FrmNew.TxtKID.Value = StrName

End Sub
Thanks for reading my thread and thanks to that that help or at least try to

I know Excel pretty well, but am just getting to grips with VBA, and am
stuck on this problem.

I am receiving enquiries from a web form which are ending up in my email
inbox. I then copy these details (the usual stuff: name, address, telephone
etc) into cells in a spreadsheet. I've been doing this by manually copying
and pasting but I'm looking for a way to speed this up, and learn some VBA
in the process.

My thought was to copy and paste the email text/data into a text box in a
userform, then hit a button to parse the data into a spreadsheet (or perhaps
as a halfway house, just split the data up and insert it into text boxes on
the same form. I know how to update a worksheet from individual
textbox/fields).

The block of text to be parsed contains the labels like "name:" , "address:"
, "email:" etc to preface the user data, though not all of these are
compulsory, so they don't always appear. Each lump of data is separated from
the next label with 3 carriage returns.

Could someone suggest an approach to this please, or even a pointer to a web
page that might help? I've done some general searching but nothing quite
answers the question.

Thank you.

Hello,

I have a userform to be populated with data from a dynamic table for purposes of showing users their daily stats.

The data is populated on the worksheet in the following way-

| a | b | c | d | e | f
--|--------------------------------------------------------------------------
1 | | User1 | user2 | user3 | user4 | user5
2 | workitem1 | | | | |
3 | workitem2 | 12 | | 12 | |
4 | workitem3 | 7 | | | | 27

etc.

When the userform is pulled up, it needs to show the following details -

UserName - User1

Workitem 2 : 12
Workitem 3 : 7

As the work items go all the way to 65, I wanted to only show the work items that had actually been worked on by each person -
What I am struggling with is how to populate the textboxes on the userform with this data - without getting into an absolute mess of if statements -


	VB:
	
 
    userformStats.WorkItemA= Range("a2").Value 
    userformStats.ItemsDoneA= Range(WorkItem1Range).Value 
     
     'etc and nested for all combinations...

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
As you can probably gather, I am somewhat of a noob and I am self teaching myself, so although I am trying to follow best practices, I am still only just picking them up.

Any help/critisism/direct insults will be appreciated... (apart from the insults, unless warrented)

Sean

Greetings.

On a UserForm, I have three ComboBoxes whicn get there data from three columns located on a worksheet(Data) next to each other (columns A, B & C). All three ComboBoxes must match with the worksheet. This will then point to only one row. I need the data that is in column D and column E, of that row, placed into TextBox3 and TextBox4.

I have included a sample workbook to look at if anyone is interested.

Any help on this project is appreciated.

-Minitman

Hi,

This is my first post here so please forgive me if it's not in the correct area. I'm fairly new to VBA so I'd appreciate responses with as much detail as possible. Thanks in advance.

As the title suggests, I am trying to think of the best way to import data into an array or worksheet then specify which column contains what data ready for further processing. The reason I need this is that I will be receiving the same data from different sources but I'm not assured that the data would be in the same layout (columns).

Example:

File one - Surname (column A), First name (column B), Title (column C)
File two - First name (column A), Surname (column B), Title (column C)
File three - Title (column A), First name (column B), Surname (column C)

My preference would be to setup some drag-and-drop userform that displays all the data I expect in one column and the available data from the file in the adjacent column. The user would then drag the image related to each data column (column 2) onto the the relevant data type in column 1 (or vice versa). If the images can be populated with column headings then that would be great otherwise column labels would be fine. Example image Drag-and-drop Userform example.png.

The alternative I thought of is that the user types the column label (A,B,C etc.) into textboxes on a userform.

I found a thread on moving images called "Allow Drag & Drop For UserForm Image" here. But I do not know if this would do the trick.

Thanks,
John

I have a userform that has two comboboxes to search data on a sheet and a textbox to input data to a specific cell on the same sheet. The cell that the textbox writes to is determined by the combination of choices selected in the comboboxes. The comboboxes are searching as required but I don't know how to determine which cell to write my data from the textbox to. I'll attempt to clarify...combobox1(drivename) searches the data in column C, combobox2(unconformlist) searches the data in column H. The combination of these determines a specific row and I need to write data from the textbox(initials) into this row in column M.
Any help is much appreciated.


	VB:
	
 CancelButton_Click() 
    Unload Me 
    Sheets("Index").Select 
End Sub 
 
Private Sub initials_Change() 
    initials = UCase(initials) 
End Sub 
 
 
Private Sub OKButton_Click() 
    Dim ws As Worksheet 
    Set ws = Worksheets("QAQCconformity") 
     
     
     'copy the data to the database
    ws.Cells(1).Offset(2, unconformlist.ListIndex + 12) = initials.Value 
     
     ' Check that each combo box contains a value
    If drivename.ListIndex = -1 Then 
        MsgBox "Please select a dive name" 
        drivename.SetFocus 
        Exit Sub 
    End If 
     
    If unconformlist.ListIndex = -1 Then 
        MsgBox "Please select an Uncomformity" 
        unconformlist.SetFocus 
        Exit Sub 
    End If 
     
    MsgBox "Do you need to to sign off another Unconformity", vbYesNo 
    If Answer  No Then 
         'Code for No button Press
        Unload Me 
        Sheets("Index").Select 
    Else 
         'Code for Yes button Press
        drivename.SetFocus 
    End If 
     'Finish and close form
     
End Sub 
 
Private Sub UserForm_Activate() 
    With unconformsignoff 
        .Top = Application.Top + 200 '< change 100 to what u want
        .Left = Application.Left + 211 '< change 211 to what u want
    End With 
     
End Sub 
 
Private Sub drivename_Change() 
     
     '   Clear other comboboxes
    Me.unconformlist.Clear 
     
     '   Load unique values for selected value in first combobox
    For Each cell In Worksheets("QAQCconformity").Range("C3", Worksheets("QAQCconformity").Range("C3").End(xlDown)) 
        If cell.Offset(0, 0) = Me.drivename Then 
            If cell.Offset(0, 0)  cell.Offset(1, 1) Then Me.unconformlist.AddItem cell.Offset(0, 5) 
        End If 
    Next cell 
     
     
End Sub 
 
Private Sub UserForm_Initialize() 
     
     '   Load unique Drivename values into first combobox
    For Each cell In Worksheets("QAQCconformity").Range("C3", Worksheets("QAQCconformity").Range("C3").End(xlDown)) 
        If cell.Offset(0, 0)  cell.Offset(1, 0) Then 
            Me.drivename.AddItem cell 
        End If 
    Next cell 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


I want to add variable content to a textbox in a userform.

I want to duplicate a Msgbox as closely as possible to allow me to position the box properly, and I would like a procedure to add a prompt to the userform as you would to a Msgbox.
That is, I have found a solution using a cell in my spreadsheet, but I would like a fully vba oriented solution.

In the message box you can say

	VB:
	
MsgBox Prompt:="Put your message here." 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
For a textbox in a userform, I can link it to a cell (say A1) and then put data into the cell


	VB:
	
Range("A1").Value = "Put your message here." 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
and it shows up in the text box when I do a


	VB:
	
Userform1.Show 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
However, I don't want to use a cell in the worksheet as the application is totally command button, and userform oriented. I have tried to use


	VB:
	
Userform1.textbox.value = "Put your message here." 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
and variations thereof but they do not work and the error messages from VB are not easy to comprehend.

Any suggestions?

As far as titles go, I can see where it would be advantageous to amend the title of a field or other object in the userform in response to certain conditions. I have not noticed any way to avoid hardcoding titles.

Hi,

I've created a userform with 10 text box's that the user enters data into then this adds the data to a worksheet. is it possible to get a textbox to calculate a sum(from textbox 9) and show this in textbox10 and allow this to be added to the worksheet ? instead of the user having to manually calculate it and then type the result into textbox10