Link to home
Start Free TrialLog in
Avatar of Southern_Gentleman
Southern_GentlemanFlag for United States of America

asked on

Updateable Textbox in Userform

I'm having trouble figuring out how to do an editable userform. The form right now is just returning information and that is it. i would like to have an UPDATE button that just changes the Print Date or (TextBox9). My information is displayed on a calendar and a userform pops up when the text is clicked on the date of the calendar.

I think i'm having trouble because the information on the userform is being populated by a VBA vlookup. The information from the Calendar and data from sheet "Print" will always change. Any advice would help. My workbook is listed below.

The form is called = userform1
The worksheet where the userform gets the information = Prints
Userform shows on sheet = Projet-Calendar New
formtest1.0.xlsm
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

I got the userform to show by typing the text "BCG in Cell E9 on the Project-Calendar New tab.

What exactly do you want to happen when you click on a new update button in the user form?

Currently you can put your cursor in the Print date field and update it to whatever you want...
Avatar of Southern_Gentleman

ASKER

When you go to the calendar sheet you can double click on the item in the calendar date (05/05/2013). Once a double click opens the userform, I would like the only editable textbox to be the Print Date (textbox9). Yes you can change the date to whatever you want but I would like it to update the source to the 'Print' sheet as well.
right now the form is populated not be a double click, but by change of selection.  For example.... if you select cell B9 which contains "BCG" that will trigger the opening of the form and populating all the fields on the form.  That data in turn is retrieved from the Print Tab.

So when you change the date on the form, I am going to assume you want the form refreshed with data as though you had selected that date on the Project-Calendar New tab to begin with.

Hopefully that is what you are asking for.

Attached is your spreadsheet with those changes.

I added an update button and added this code to exectute when the update button is clicked.
Private Sub CommandButton2_Click()
    Dim searchDate As Date
    Dim targetCell As Range
    
    searchDate = UserForm1.TextBox9
    
    Set targetCell = Worksheets("Project-Calendar New").Range("b6:h15").Find(searchDate, LookIn:=xlValues)
    
    If Not targetCell Is Nothing Then
            Cells(targetCell.Row + 1, targetCell.Column).Select
    End If
    
End Sub

Open in new window

I also updated the code in Project-Calendar New.  Since the userform is already opened... and selecting a new cell (this time with code), you don't want to show the form again because that will cause an error.  So I made a small change to only show the form if it was not already visible.
If Not UserForm1.Visible Then
    UserForm1.Show
End If

Open in new window

formtest1.0.xlsm
Thanks Buttersk, I see that the calendar is updated but its not actually syncing with the data on the 'Print' sheet. I think if the date is changed in the userform and the value is directly linked to the Date cell from the 'Print' sheet then I can rerun the "GetSRs" macro in the update button.  

I'm also looking for a way to Display more information in the actual calendar date. So right now it has it shows BCG, AMG, or TTI. I would like to show the Order Number, Print Shop, and  QTY. So the date in the calendar would show   198   BCG   400 instead of just BCG in the 05/05/2013 date.
ASKER CERTIFIED SOLUTION
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Buttersk. I was playing around with it and worked the way I wanted it to. I was trying to put more information on the calendar and was having trouble showing row data from column A, C, and F. So for June 15, 2013 on the calendar, instead of just showing BCG, how would I show  BCG   354   221.  Possibly with 3 spaces between each string item.  The 345 is the order number and the 221 is the Qty.

I asked a similar question regarding this concatenate but it wasn't answered. I'll mark this as answered. Thanks again

https://www.experts-exchange.com/questions/28142526/Concatenate-fields-into-calendar-date.html