Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 10-02-2017, 01:48 PM
SonnyH666 SonnyH666 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
SonnyH666 is on a distinguished road
Default Userform textboxes

Hi everyone



I have been looking for a solution for my problem for the last 6 hours by googling and what not and still i cant find any solution so im trying my luck here.

Ive made an template to fill out dividers for physical folders, where press a button and user form pops up where i can fill out my data, which then is being inserted in tables with bookmarks, so far so good, now one of my colleagues (this is Work related) wanted to be able to highlight the text in the textboxes and then copy paste it into another textbox and fill out the values past the one you past into first....(kinda hard to explain as English isnt my native language so bare with me). Like in tables when you want to move everything one place Down you hightlight everything place the cursor in the table you wanna start in and the paste and the rest of the tables gets filled out. But i cant seem to find any options to hightlight text in multiple textboxes sooo I was considering a button called move up and a button called move Down and when you press the move Down all text gets moved to the textbox below and the rest of the text in the other boxes gets filled out after that.

IVe tried this code but cant get it to Work
https://www.mrexcel.com/forum/excel-...m-up-down.html
ive then tried something along the line with replace text from textboxX to textboxY but it doesnt quiet Work as i want it to, so i was hoping anyone in here could point me in the right direction. FYI im totally new to VBA, and everything ive made has been codes ive found around the web and somehow put it together to make it Work (pure luck if you ask me).
If description is confusing i can make som screenshots of what i want or even upload my template if needed, thanks in advance
Reply With Quote
  #2  
Old 10-02-2017, 03:12 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,331
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

If you want multiple copies, simply add a field to your userform that allows the user to specify the number of copies, then have your code create as many as needed. Either way, there is no need to select (highlight) anything; it can all be done by referencing the table and/or cells concerned. Without seeing your document & userform, though, it's impossible to be more specific.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 10-03-2017, 12:55 AM
SonnyH666 SonnyH666 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
SonnyH666 is on a distinguished road
Default

Thats a great idea and i think that could work..

let me show you what i mean.



And either with highlighting or push of a button or something along the lines i want to be able to insert like this



So that i can push something in between the boxes.
What i do now is cut/paste from one text box to another

how would an example of a code look like with want you mentioned?
My text boxes are name Textbox 1-how many there are.
On screenshots the 2 texboxes on the left are name Textbox1 and Textbox2.
The boxes on the right stated with numbers are named Textbox3 (the big one) and textbox4 (the small one) and so forth.
So the code could be like cut/paste from textbox3 to textbox5 and textbox 4 to textbox6 or maybe it should be on focus so if i put my mouse on text box 7 it moves from there and downwards.....not sure how this can actually work out
Reply With Quote
  #4  
Old 10-03-2017, 01:26 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,331
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

As I said in my previous reply:
Quote:
Originally Posted by macropod View Post
Without seeing your document & userform, though, it's impossible to be more specific.
Screenshots aren't particularly helpful substitutes.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 10-03-2017, 01:42 AM
SonnyH666 SonnyH666 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
SonnyH666 is on a distinguished road
Default

Ive uploaded the file
Attached Files
File Type: docm Fane1L_MST_31_V1.1.docm (154.3 KB, 2 views)
Reply With Quote
  #6  
Old 10-03-2017, 03:38 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,331
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

So what, exactly, do you want to replicate? From post #3, it seems you want to make multiple copies of Station 4, but I can't see what logic would lie behind the replicas becoming Station 4.5 & Station 4.6, instead of more exact copies of Station 4.

PS: FWIW, all your bookmarks are unnecessary - you can work with each cell directly by its address in the table.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 10-03-2017, 04:15 AM
SonnyH666 SonnyH666 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
SonnyH666 is on a distinguished road
Default

ohh i wasnt aware of that with the bookmarks how do i addresss a cell?

ok here is an example, lets say i fill out the whole page, from 1 to 10 but then i realize that i need to move everything from 6 and forward down 2 places so i can fill in 6 and 7 with new information but the information from that were in 6 and forward to begin with should move to 8 and just fill out what ever was beyond 6 so that the fields between 6 and 8 becomes blank so i can fill out the missing information......wonder if it makes sense....

But thats just one example i was looking for a way where i can move what ever around once its filled out. Just like if you wanna move information around in normal table with cut/paste....

The file i uploaded have 31 "rows" i can fill out, problem comes when i fill out row 1 to 25 but i realise that i forgot something in row 4, so i need that row to cut/paste everything from that row to the next row (5) so row 4 becomes blank but the date just moves forward so the last row will become row 26
Reply With Quote
  #8  
Old 10-03-2017, 04:34 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,331
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Try the attached.

Note that you can either use the form for moving the data so you can insert rows, or you can do it in the table directly, since there are now no bookmarks to be concerned about.
Attached Files
File Type: docm Fane1L_MST_31_V1.1.docm (173.1 KB, 6 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #9  
Old 10-03-2017, 11:49 PM
SonnyH666 SonnyH666 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
SonnyH666 is on a distinguished road
Thumbs up

Truly amazing job, exactly what i was looking for, and now my userform Works even better without bookmarks i cant thank you enough.
Out of pure curiosity, would it be possible to reverse the new code as well? so instead moving it all Down it could be moved upwards?
Reply With Quote
  #10  
Old 10-04-2017, 12:07 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,331
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by SonnyH666 View Post
Out of pure curiosity, would it be possible to reverse the new code as well? so instead moving it all Down it could be moved upwards?
Yes, that would be possible, but the likely result would be to delete some existing content. Do note that you can make such edits quite easily in the document itself.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #11  
Old 10-04-2017, 12:09 AM
SonnyH666 SonnyH666 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
SonnyH666 is on a distinguished road
Default

Hmm yeah makes sense, once Again thanks for you help and time
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Userform Captions, TextBoxes, Command buttons From Excel dan88 Word VBA 3 05-22-2016 08:59 AM
Userform calls other userform, then populate worksheet Lehoi Excel Programming 0 02-03-2016 02:58 PM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
UserForm Search with multiple TextBoxes johndough Excel Programming 0 05-10-2014 12:11 PM
Many textboxes on top of each others? Giygas PowerPoint 1 12-05-2010 02:59 PM


All times are GMT -7. The time now is 04:38 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft