![]() |
|
#1
|
|||
|
|||
|
I have a userform that fills a table cell either red, amber or green to RAG rate reports - something I do a lot, so this is a really good time saver. My issue is that I have to click twice to return to select the next cell. So:
Current cell active, click colour button on userform and it fills the cell (great) Userform remains active, so I need to click the document away from the userform to gain focus, then click the next cell I want (not so great). https://www.loom.com/share/c34bdc89d...f-2ffceee0e374 |
|
#2
|
|||
|
|||
|
I'm assuming you must be displaying the form with .Show vbModeless.
In each command button event. Add Application.Activate Private Sub CommandButton1_Click() Selection.Cells(1).Shading.BackgroundPatternColor = wdColorAqua Application.Activate End Sub Private Sub CommandButton2_Click() Selection.Cells(1).Shading.BackgroundPatternColor = wdColorBlue Application.Activate End Sub Private Sub CommandButton3_Click() Selection.Cells(1).Shading.BackgroundPatternColor = wdColorBrightGreen Application.Activate End Sub |
|
#3
|
|||
|
|||
|
Spot on - thank you! I spent 20 minutes with ChatGPT trying to do this and it couldn't figure it out - works a dream, thank you!
|
|
#4
|
|||
|
|||
|
Its ChatGPT one of those Artificial Idiots? If so, no wonder.
|
|
#5
|
|||
|
|||
|
Ha, that's it - got me half way there creating the form and the buttons but not the rest!
|
|
#6
|
|||
|
|||
|
A shame really. Those gizmos have cut the volume in these forums to a trickle. From my experience, the solutions they provide are usually half baked, if that.
|
|
#7
|
|||
|
|||
|
Absolutely true - I used it for something for my website, wrote me a php function that worked a treat. I asked, "is this secure?" The response was essentially, "oh no, not at all."
It's useful it you have some knowledge - but like this example, I don't know what I don't know so how no idea how to fix it so was clearly asking the wrong questions. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Hyperlink object - change ctrl+click to click?
|
ld2x07 | Word | 5 | 10-10-2014 05:13 AM |
| Change focus from userForm back to word document to see results. | Hank Smith | Word VBA | 1 | 08-11-2014 05:00 AM |
Show userform without losing document focus? Or other method to get a graphic to pop?
|
AlexR | Word VBA | 7 | 03-31-2013 12:17 PM |
| Title: Why does focus fail to change to MyPic2.jpg (intermittently) after .addPictur | CatMan | PowerPoint | 6 | 05-10-2012 10:25 PM |
Setting focus to specific word document from UserForm
|
SaneMan | Word VBA | 5 | 04-01-2011 03:11 PM |