![]() |
box with the content of D26
Hi all,
At the end of my code I need a line that will let pop up a box in which I see the content of cell D26 without halting execution of the code. (In fact the code immediately following the needed "pop up line" is Exit Sub.) I want to be able to higlight the text in the popped up box in order to copy it with ctrC=ctrV to a Word document. Your assistance will be appreciated. Jack Sons The Netherlands |
box with the content of D26
Why not just do Range("D26").Copy? This puts a copy of D26 into the
clipboard for you, all you then have to do is paste into Word. But if you need a popup textbox for some other reason, create a userform and set its ShowModal property to False. Put a textbox on it and size it to your liking, then use UserForm1.Textbox1.Value = Range("D26").Value to put the cell value into the userform. -- - K Dales "Jack Sons" wrote: Hi all, At the end of my code I need a line that will let pop up a box in which I see the content of cell D26 without halting execution of the code. (In fact the code immediately following the needed "pop up line" is Exit Sub.) I want to be able to higlight the text in the popped up box in order to copy it with ctrC=ctrV to a Word document. Your assistance will be appreciated. Jack Sons The Netherlands |
box with the content of D26
K Dales,
Thans for your help. My code now shows this ---------------------------------------------------------- UserForm1.TextBox1.Value = Range("D30").Value Exit Sub ---------------------------------------------------------- but I see nothing popping up. I made an useform, it is called userform1 and it contains textbox1. If I right click on the textbox I can put code in a sub. I did so, it now is like below --------------------------------------------------------- Private Sub TextBox1_Change() UserForm1.TextBox1.Value = Range("D30").Value End Sub --------------------------------------------------------- Perhaps better that I show the whole code, see below. Eh, don't laugh, I have no idea how it works! I just know that selecting the sheet executes the sub and that by holding alt down while selecting the sub will not be executed. I would really like to know what the eight lines after the last "Dim" do, even if they are not needed here (they come from another project). The purpose of the whole thing is that when I select the sheet a random operation is executed by the instruction "execute". A certain formula shows its result in A26 and its value is pasted special to A30. So far so good, but nothing pops up. What did I do wrong? Jack. ----------------------------------------------------------- Option Explicit Private Declare Function GetKeyState Lib "user32" _ (ByVal nVirtKey As Long) As Integer Private Sub Worksheet_Activate() Dim ResL As Long Dim ResR As Long Dim ResE As Long Const VK_LMENU = &HA4 Const VK_RMENU = &HA5 Const VK_MENU = &H12 ResE = GetKeyState(VK_MENU) ResL = GetKeyState(VK_LMENU) ResR = GetKeyState(VK_RMENU) 'MsgBox "L=" & ResL & vbLf & "R=" & ResR & vbLf & "E=" & ResE If ResL = 0 And ResR = 0 And ResE = 0 Then 'don't process if Alt is held down Calculate Range("A26").Select Selection.Copy Range("A30").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False UserForm1.TextBox1.Value = Range("A30").Value Exit Sub End If End Sub ---------------------------------------------------------------------- "K Dales" schreef in bericht ... Why not just do Range("D26").Copy? This puts a copy of D26 into the clipboard for you, all you then have to do is paste into Word. But if you need a popup textbox for some other reason, create a userform and set its ShowModal property to False. Put a textbox on it and size it to your liking, then use UserForm1.Textbox1.Value = Range("D26").Value to put the cell value into the userform. -- - K Dales "Jack Sons" wrote: Hi all, At the end of my code I need a line that will let pop up a box in which I see the content of cell D26 without halting execution of the code. (In fact the code immediately following the needed "pop up line" is Exit Sub.) I want to be able to higlight the text in the popped up box in order to copy it with ctrC=ctrV to a Word document. Your assistance will be appreciated. Jack Sons The Netherlands |
box with the content of D26
maybe another line (next)
userform1.show Just a guess/// "Jack Sons" wrote in message ... K Dales, Thans for your help. My code now shows this ---------------------------------------------------------- UserForm1.TextBox1.Value = Range("D30").Value Exit Sub ---------------------------------------------------------- but I see nothing popping up. I made an useform, it is called userform1 and it contains textbox1. If I right click on the textbox I can put code in a sub. I did so, it now is like below --------------------------------------------------------- Private Sub TextBox1_Change() UserForm1.TextBox1.Value = Range("D30").Value End Sub --------------------------------------------------------- Perhaps better that I show the whole code, see below. Eh, don't laugh, I have no idea how it works! I just know that selecting the sheet executes the sub and that by holding alt down while selecting the sub will not be executed. I would really like to know what the eight lines after the last "Dim" do, even if they are not needed here (they come from another project). The purpose of the whole thing is that when I select the sheet a random operation is executed by the instruction "execute". A certain formula shows its result in A26 and its value is pasted special to A30. So far so good, but nothing pops up. What did I do wrong? Jack. ----------------------------------------------------------- Option Explicit Private Declare Function GetKeyState Lib "user32" _ (ByVal nVirtKey As Long) As Integer Private Sub Worksheet_Activate() Dim ResL As Long Dim ResR As Long Dim ResE As Long Const VK_LMENU = &HA4 Const VK_RMENU = &HA5 Const VK_MENU = &H12 ResE = GetKeyState(VK_MENU) ResL = GetKeyState(VK_LMENU) ResR = GetKeyState(VK_RMENU) 'MsgBox "L=" & ResL & vbLf & "R=" & ResR & vbLf & "E=" & ResE If ResL = 0 And ResR = 0 And ResE = 0 Then 'don't process if Alt is held down Calculate Range("A26").Select Selection.Copy Range("A30").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False UserForm1.TextBox1.Value = Range("A30").Value Exit Sub End If End Sub ---------------------------------------------------------------------- "K Dales" schreef in bericht ... Why not just do Range("D26").Copy? This puts a copy of D26 into the clipboard for you, all you then have to do is paste into Word. But if you need a popup textbox for some other reason, create a userform and set its ShowModal property to False. Put a textbox on it and size it to your liking, then use UserForm1.Textbox1.Value = Range("D26").Value to put the cell value into the userform. -- - K Dales "Jack Sons" wrote: Hi all, At the end of my code I need a line that will let pop up a box in which I see the content of cell D26 without halting execution of the code. (In fact the code immediately following the needed "pop up line" is Exit Sub.) I want to be able to higlight the text in the popped up box in order to copy it with ctrC=ctrV to a Word document. Your assistance will be appreciated. Jack Sons The Netherlands |
box with the content of D26
Yes, need to show the userform. Sorry, wrote my response with assumption you
knew how to display userforms. -- - K Dales "Jim May" wrote: maybe another line (next) userform1.show Just a guess/// "Jack Sons" wrote in message ... K Dales, Thans for your help. My code now shows this ---------------------------------------------------------- UserForm1.TextBox1.Value = Range("D30").Value Exit Sub ---------------------------------------------------------- but I see nothing popping up. I made an useform, it is called userform1 and it contains textbox1. If I right click on the textbox I can put code in a sub. I did so, it now is like below --------------------------------------------------------- Private Sub TextBox1_Change() UserForm1.TextBox1.Value = Range("D30").Value End Sub --------------------------------------------------------- Perhaps better that I show the whole code, see below. Eh, don't laugh, I have no idea how it works! I just know that selecting the sheet executes the sub and that by holding alt down while selecting the sub will not be executed. I would really like to know what the eight lines after the last "Dim" do, even if they are not needed here (they come from another project). The purpose of the whole thing is that when I select the sheet a random operation is executed by the instruction "execute". A certain formula shows its result in A26 and its value is pasted special to A30. So far so good, but nothing pops up. What did I do wrong? Jack. ----------------------------------------------------------- Option Explicit Private Declare Function GetKeyState Lib "user32" _ (ByVal nVirtKey As Long) As Integer Private Sub Worksheet_Activate() Dim ResL As Long Dim ResR As Long Dim ResE As Long Const VK_LMENU = &HA4 Const VK_RMENU = &HA5 Const VK_MENU = &H12 ResE = GetKeyState(VK_MENU) ResL = GetKeyState(VK_LMENU) ResR = GetKeyState(VK_RMENU) 'MsgBox "L=" & ResL & vbLf & "R=" & ResR & vbLf & "E=" & ResE If ResL = 0 And ResR = 0 And ResE = 0 Then 'don't process if Alt is held down Calculate Range("A26").Select Selection.Copy Range("A30").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False UserForm1.TextBox1.Value = Range("A30").Value Exit Sub End If End Sub ---------------------------------------------------------------------- "K Dales" schreef in bericht ... Why not just do Range("D26").Copy? This puts a copy of D26 into the clipboard for you, all you then have to do is paste into Word. But if you need a popup textbox for some other reason, create a userform and set its ShowModal property to False. Put a textbox on it and size it to your liking, then use UserForm1.Textbox1.Value = Range("D26").Value to put the cell value into the userform. -- - K Dales "Jack Sons" wrote: Hi all, At the end of my code I need a line that will let pop up a box in which I see the content of cell D26 without halting execution of the code. (In fact the code immediately following the needed "pop up line" is Exit Sub.) I want to be able to higlight the text in the popped up box in order to copy it with ctrC=ctrV to a Word document. Your assistance will be appreciated. Jack Sons The Netherlands |
box with the content of D26
Jim and K Dales,
Lots of thanks, it works! Jack. "K Dales" schreef in bericht ... Yes, need to show the userform. Sorry, wrote my response with assumption you knew how to display userforms. -- - K Dales "Jim May" wrote: maybe another line (next) userform1.show Just a guess/// "Jack Sons" wrote in message ... K Dales, Thans for your help. My code now shows this ---------------------------------------------------------- UserForm1.TextBox1.Value = Range("D30").Value Exit Sub ---------------------------------------------------------- but I see nothing popping up. I made an useform, it is called userform1 and it contains textbox1. If I right click on the textbox I can put code in a sub. I did so, it now is like below --------------------------------------------------------- Private Sub TextBox1_Change() UserForm1.TextBox1.Value = Range("D30").Value End Sub --------------------------------------------------------- Perhaps better that I show the whole code, see below. Eh, don't laugh, I have no idea how it works! I just know that selecting the sheet executes the sub and that by holding alt down while selecting the sub will not be executed. I would really like to know what the eight lines after the last "Dim" do, even if they are not needed here (they come from another project). The purpose of the whole thing is that when I select the sheet a random operation is executed by the instruction "execute". A certain formula shows its result in A26 and its value is pasted special to A30. So far so good, but nothing pops up. What did I do wrong? Jack. ----------------------------------------------------------- Option Explicit Private Declare Function GetKeyState Lib "user32" _ (ByVal nVirtKey As Long) As Integer Private Sub Worksheet_Activate() Dim ResL As Long Dim ResR As Long Dim ResE As Long Const VK_LMENU = &HA4 Const VK_RMENU = &HA5 Const VK_MENU = &H12 ResE = GetKeyState(VK_MENU) ResL = GetKeyState(VK_LMENU) ResR = GetKeyState(VK_RMENU) 'MsgBox "L=" & ResL & vbLf & "R=" & ResR & vbLf & "E=" & ResE If ResL = 0 And ResR = 0 And ResE = 0 Then 'don't process if Alt is held down Calculate Range("A26").Select Selection.Copy Range("A30").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False UserForm1.TextBox1.Value = Range("A30").Value Exit Sub End If End Sub ---------------------------------------------------------------------- "K Dales" schreef in bericht ... Why not just do Range("D26").Copy? This puts a copy of D26 into the clipboard for you, all you then have to do is paste into Word. But if you need a popup textbox for some other reason, create a userform and set its ShowModal property to False. Put a textbox on it and size it to your liking, then use UserForm1.Textbox1.Value = Range("D26").Value to put the cell value into the userform. -- - K Dales "Jack Sons" wrote: Hi all, At the end of my code I need a line that will let pop up a box in which I see the content of cell D26 without halting execution of the code. (In fact the code immediately following the needed "pop up line" is Exit Sub.) I want to be able to higlight the text in the popped up box in order to copy it with ctrC=ctrV to a Word document. Your assistance will be appreciated. Jack Sons The Netherlands |
All times are GMT +1. The time now is 12:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com