Drag and drop text in userform text / combo boxes

I am using userforms alot for data entry.

Is there a way to allow one to drag and drop text from one text box / combo 
box to another?

This would be especially useful since it would allow me to move entered data 
down or up within the userform during editing.  However i cannot drag text 
from one box to another (as one can in say word or in the sheet itself).

Can anyone help?
0
Utf
11/22/2009 6:13:02 AM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
1840 Views

Similar Articles

[PageSpeed] 57

This is very basic just to get you started. There's a lot more you will 
probably want to do, also slightly different approaches -

'' put some text in Textbox1
'' press left button and hold Ctrl with mouse over Textbox1
'' drag and release over Textbox2


Private msText As String

Private Sub TextBox1_BeforeDragOver( _
                ByVal Cancel As MSForms.ReturnBoolean, _
                ByVal Data As MSForms.DataObject, _
                ByVal X As Single, ByVal Y As Single, _
                ByVal DragState As MSForms.fmDragState, _
                ByVal Effect As MSForms.ReturnEffect, ByVal Shift As 
Integer)
    Cancel = True
End Sub

Private Sub TextBox1_MouseDown(ByVal Button As Integer, _
                ByVal Shift As Integer, ByVal X As Single, ByVal Y As 
Single)

    If Button = 1 And Shift = 2 Then
        Set dataObj = New MSForms.DataObject
        msText = TextBox1.Text
        dataObj.StartDrag
    End If
End Sub


Private Sub TextBox1_MouseUp(ByVal Button As Integer, _
            ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

    msText = ""

End Sub

Private Sub TextBox2_BeforeDragOver( _
                    ByVal Cancel As MSForms.ReturnBoolean, _
                    ByVal Data As MSForms.DataObject, _
                    ByVal X As Single, ByVal Y As Single, _
                    ByVal DragState As MSForms.fmDragState, _
                    ByVal Effect As MSForms.ReturnEffect, _
                    ByVal Shift As Integer)

        Cancel = True
End Sub

Private Sub TextBox2_BeforeDropOrPaste( _
                    ByVal Cancel As MSForms.ReturnBoolean, _
                    ByVal Action As MSForms.fmAction, _
                    ByVal Data As MSForms.DataObject, _
                    ByVal X As Single, ByVal Y As Single, _
                    ByVal Effect As MSForms.ReturnEffect, _
                    ByVal Shift As Integer)

    TextBox2.Text = msText

End Sub

Regards,
Peter T


"Roger on Excel" <RogeronExcel@discussions.microsoft.com> wrote in message 
news:F9CD673C-BFFE-4A40-B45A-88632DD45721@microsoft.com...
>I am using userforms alot for data entry.
>
> Is there a way to allow one to drag and drop text from one text box / 
> combo
> box to another?
>
> This would be especially useful since it would allow me to move entered 
> data
> down or up within the userform during editing.  However i cannot drag text
> from one box to another (as one can in say word or in the sheet itself).
>
> Can anyone help? 


0
Peter
11/22/2009 11:34:15 AM
Reply:

Similar Artilces:

Filling drop down box
hi, I have a drop down box in a cell. Based on a value of anohter cell I have to fill my drop down box. what i mean is, say if GreeNPackage is "No" then I want the drop down box to fill a range of values. But if the GreeNPackage is "Yes" then I want the drop down box to fill another set of values. how can i do this? plenty of thanks See reply in .Functions Biff >-----Original Message----- >hi, > >I have a drop down box in a cell. Based on a value of >anohter cell I have to fill my drop down box. what i mean >is, say if >GreeNPackage is ...

data from a modeless dialog box to its parent
I need to post a text data from a modeless dialog box to its parent which is itself a dialog based application. Since it should be a large text data a simple Windows message won't be good. What is the right way to do that? Thanks Gil If you are sure the data will stay current you can post the address of the data (as a pointer) in a windows message to the parent. If you want to be really sure use SendMessage() which will wait until the parent gets the message before returning. You could call a function or copy the data to a variable in the parent dialog, but that could be dang...

Mail merge recipient dialog box
Why are the "edit" and "refresh" buttons at the bottom of the mail merge recipient dialog box grayed out? They were available in the last Word version but I cannot figure how to access them in 7 to add to or correct my mailing list. In Word 2007, the first thing you have to do is select the name of the data source in the box at the bottom left of the dialog box. Then, depending on the type of data source, the Edit and Refresh buttons may be ungreyed. [FWIW the same dialog is used by MS Publisher, where they allow multiple data sources, requiring you to ...

Printing Userforms [Landscape]
Can anyone assist I have many userforms which at regular intervals will need to be printed, some are to be printed in Portrait others in Landscape. It prints find in Portrait, but how can I change the settings so that it prints in Landscape, I tried the following to no avail by showing the Dialog Printer SetUp and manually changing the setting to Landscape but this still doesn't work. any ideas? Sub Print_UserForm Dim Response as boolean With ufStock_Sheet Response = Application.Dialogs(xlDialogPrinterSetup).Show If reply = False Then Exit ...

Userforms
I use listboxes in userforms with multiple columns for displaying rows of information pulled from the spreadsheet. Is there a way to add vertical (and horizontal) gridlines to separate the different columns (rows) of data. The listbox just displays the information hanging in free space with no dividers between columns of data. Can anyone help? It seems really strange that a gridlines option doesnt seem to be available? Thanks in advance, Roger Not that I know of. You can resized the window of the control so that only one line shows and you can space the columns with...

Save a Copy/Overwrite changes dialog box
All of a sudden, this dialog box pops up every time I want to save something in Excel 2002. The box says, "The file '<file name>' may have been changed by another user since you last saved it. In that case, what do you want to do? __ Save a Copy __ Overwrite changes even though I'm the only user that's changed anything in the past 3 years. The shared workbook command has not been changed at all, so that can't be the problem. The settings are the same as the ones I have at home for personal spreadsheets that don't have this dialog box. Help! Than...

enter value based on drop down list of another field?
I have an excel 2003 spreadsheet with 3 worksheets. In sheet 1, I created a drop down list in column A based on values in sheet 3, column A (item number). Thisd data comes from sheet 3, where I have column A (Item #'s), column B (Item desc)an Column C (price) In column B of sheet 1, I have Item Descriptions and in column C I have price. I want this to automatically fill in based on what I enter in the column A sheet 1 and it should get the corresponding values from sheet 3 column B and C. I can make the drop down list in sheet 1 column B and C, but some of the descriptions need ...

combo box list updating
Hi - I would like my combo box list to change base on the value of A1. That is, I have its input range being B1:F1 - "Year 1", " Year 2" etc. Example: -If cell A1 is the value "10" then the combo box default list item would be "Year 1" (which is cell "B1") -If cell A1 is the value "20" then the combo box default list item would be "Year 2" (which is cell "C1") ETC... Thanks for your help - Jim A ...

"Find a contact box" problem
Hi. I�m having problems with the �Find a contact� box on the Standard toolbar. Previously, I would type in a name and the search would pull up name/s from the Outlook Contacts folder first then, if the name is not in the Contacts folder, it would pull up name/s from the Global Address List if any. Now, when I type in a name, the search only pulls up name/s from the Global Address List. The search does not include the Contacts folder although there are entries in the Contacts folder. The problem started after I transferred a couple of Contacts subfolders to another pst file. How do I fix the p...

Counting Texts
If cell A1 contains a paragraph of texts and if I want to count just letter "W"s (Upper or lower case), How can I achieve this? Example: A1 contains "How now brown cow" the formula should return "4". Thank you. Write a macro and use the VBA functions Instr(strName, "w") together with Split(strName, "w") and count the number of times that it finds "w" or "W" Chris "Keith" <Keith@discussions.microsoft.com> wrote in message news:CC60AA13-B569-4C55-BDC7-1B6295CDAFB9@microsoft.com... > If cell A1 co...

need help with list box?
Hi I have a huge table of about 20000 records. how can I restrict entry for a few columns. I am new to excel programming. For example. I have a list of colors (red, green, blue) that I want to go under the Color column. how can I allow the user to click on a pulldown or list box similar to ms access for each cell. thanks in advance. Hi you could use 'Data - Validation'. See: http://www.contextures.com/xlDataVal01.html >-----Original Message----- >Hi > >I have a huge table of about 20000 records. how can I restrict entry for a >few columns. >I am new to exc...

Check box question 04-23-07
I have a form with a check box used to indicate if a receipt is voided or not. What I'm trying to do is go to a new record after the checkbox is marked. I have the following code in place and it works. Kinda. The problem is that if I then go back and UNCHECK the check box, it sends me to a new record again. Here's the code: Private Sub Check43_AfterUpdate() If Ckeck43 = Yes Then DoCmd.GoToRecord , , acNewRec Thanks for any help! End Sub The following works fine for me. If Me.Check3 = True Then DoCmd.GoToRecord , , acNewRec so try If Ckeck43 = True Then DoCmd.GoToRecor...

Emails missing text
We have about 80 users on our Exchange server. We have 2 users that have an issue with reading their email. It appears that when they open the email the right side of the email/text is gone. When I shadow their session I can see the entire email but they cannot. It is as if they right section of the text of the email was deleted. I'm sorry I'm not explaining this well. Any feedback is appreciated. Thanks ...

how do i change or remove a signiture that is under outo text hea.
Someone please help i am using outlook 2003 and i am triyng to change a signiture that is under auto text. to get into it i open a message push insert then outo text then signiture. I want to change it. I have closed the untilted message gone to tools then options then mail format then signitures then remove all the signitures but the signiture under insert and outo text is still there See if this helps: http://office.microsoft.com/en-us/word/HP051860291033.aspx -- Bill R "nearly bald with frustration" <nearly bald with frustration@discussions.microsoft.com> wrote i...

Export excel file to semicolon delimited text file
Hello all. We have the need to export a file from excel to a semicolon delimited text file. Is there a way to do this from Excel directly? If not, does anyone have any other suggestions? TIA for your help. If you change your regional settings to use the semicolon as your list separator, you can save as .csv and it should work. But this may affect other programs, too--since it's a windows setting. windows start button|settings|control panel|regional and language options| regional options tab|customize button near the bottom. On the other hand, if you don't want to fiddle with...

Some contacts don't show on drop down box when addressing email
I was using Outlook Express, my computer motherboard died, got new computer with Windows 7, trying to learn Outlook 2003. The computer tech from my husband's office put Outlook 2003 on the new computer and somehow transferred the addresses that I had in Outlook Express. I do not know what method he used to get the addresses into Outlook 2003. Some things carried over just fine, some things didn't, i.e. a group list of my subdivision property owners, so I had to re-make that distribution list. When I want to email my daughter, her name or email address is not s...

text size in reading pane
Where is the font selection / text size control for the Outlook 2003 reading pane (incoming emails)? I just bought a brand new dell with windows xp and all and I can't even increase the text size of incoming emails as I could with older versions of Outlook Express. I have been trying to figure this out for around 15 hours now and have come up empty. What kind of progress is this anyway???? A program rendered unable to accomplish such a simple practical thing like that!! Im very upset. My vision is poor. Unless I get an answer soon, I am considering a return of this unit to dell...

Drag Drop problem in CListCtrl
Hello , I have a CListCtrl which displays the thumbnail view of image files & other related info like file size , destination.The owner drawn property of the list cntrl is set to true. I want to be able to drag - drop the thumbnails within the list view itself. But the dragged image of the selected list item is always displayed as a black bitmap.I have used CreateDragImage , BeginDrag , DragEnter , DragMove etc for this.Why is this problem ocurring???? Also if instead of having the dragged image of the item to be displayed , i have set a default bitmap, but it too doesn't get displa...

can't see text in any office files anymore
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel on my macbookpro: can't see text in any office files anymore (word, powerpoint, excel). only when using preview function from OSX. <br> what's wrong??? <br> do I have to re-install the all suite? any quick fix? ...

Help Creating A Formula To Copy and Paste Text
Hi everyone. Thanks in advance for any help you may have. I need to create a formula that searches for a specific word in a column then cut the word and paste it to another column. Of course this would be simple if it was the only word in the column, but there is other text that I would like to remain in the orginal column.. Thanks again, Mary You have a reply at your other thread. Mary wrote: > > Hi everyone. Thanks in advance for any help you may have. > > I need to create a formula that searches for a specific word in a > column then cut the word and paste it to ...

Rich Text formatting in Access 2007
In Access 2007, is it possible to add rich text formatting to text in a memo field (or mixed formatting within any text field). I have just upgraded to the new version of Access, and it appears that this feature still has not been added. Is this correct? (If so, why?) If it is not possible to format individual words within a field in Access, , is there a simple, free add-in that will enable Access to do this kind of basic formatting, such as adding italic, bold, and underlining? Thanks very much for any information you may have. Bob Rich Text format for Memos in: Tables - Look in t...

Footnote text cannot be entered without mouse click
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Normally adding a footnote number automatically adds that number to the bottom of the page. A blinking text entry indicator normally allows me to enter the footnote text without any additional step. <br><br>However, today I wanted to add a footnote number after a word, and although the corresponding number correctly appears at the bottom of the page, and the blinking text entry indicator also appears ready to allow entering footnote text, yet when I try to type, nothing is entered. I must resort to ...

Add numbers accross columns after stripping away text
I have the following data in a spreadsheet: A1 B1 C1 D1 E1 F1 4.5f 6f 3.5f 3f 7.25f I need to be able to add the numbers together to give me 24.25, i.e. strip the fs away. The numbers will always be less than 10 and the there will only ever be .25 or.5 or .75 after the number (I don't know whether that is significant?). If anyone can show me how to do this I would be very grateful. I have been messing around with MID and FIND to no avail and then started thinking that SUMPRODUCT might have to get involved but it all got a bit m...

Shortcut into Name box
Hi there. Using E02 on XP. I'm using the Name box (above A1) and wonder if there isn't a keystroke to 'jump' into it quickly? Thanks in advance for any help! Depends on what you use it for. If you quickly want to jump to a named range, you can also use F5. -- Kind Regards, Niek Otten Microsoft MVP - Excel "Bonnie" <Hambrick@discussions.microsoft.com> wrote in message news:454a01c520c2$f4137fb0$a401280a@phx.gbl... > Hi there. Using E02 on XP. I'm using the Name box (above > A1) and wonder if there isn't a keystroke to 'jump' into ...

Combo box default value multiautocomplete
Hi All i have a subform with 10 item. The first one is a combo box that can choose the value from a list that is linked to a table with many record. This subform is related to the master form with link master field codice,cognome,nome link child field codice,cognome,nome that are the other items that are not visualize in the subform. These link give me the right connection to the master form. Normally when i choose the value from list (table) i place also all the other item in the subform using this code in after update precedure Me.ISEE.Value = Me.ISEE.Column(0) Me.F_Costo_con_M...