Updateable Textbox in Userform

Posted on 2013-06-09
Last Modified: 2013-06-14
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
Question by:Southern_Gentleman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 19

Expert Comment

by:Ken Butters
ID: 39234961
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...

Author Comment

ID: 39236702
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.
LVL 19

Expert Comment

by:Ken Butters
ID: 39237930
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
End If

Open in new window

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 39240246
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.
LVL 19

Accepted Solution

Ken Butters earned 500 total points
ID: 39242101
If I understand what you want.. then part of the problem doesn't have anything to do with the Form.

When you select a value on the calendar... you are not finding the right row in "Print" sheet.  That is because the target data you are looking for on the calendar is the print shop.... there is more than 1 matching row on the Print sheet that has the value of "BCG" for print shop... and your VLookup was always just finding the first one.

I changed how you searched the print sheet to find the matching row based on both the Print Date and the Print Shop.
I changed the selection change event on the Project-Calendar New to do nothing for row 1.
I removed the update button on the form entirely
I Changed the textbox for print date on the form from a text box to a combo box.
The combobox is filled with all possible dates from the Print sheet.
Selecting an a Print Date from the combbox will trigger the following"
  1) Refresh the calendar if it is not displaying the correct month
  2) select the date from the combo box on the displayed calendar
  3) Refresh the rest of the data in the form with data from the print sheet for that calendar data item.

Author Comment

ID: 39246614
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot locate cell 15 43
Vlookup Help 3 30
format is changing when i run the find and replace macro 8 26
Need to count  the pair 35 23
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question