Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello everybody. I have a question: I need a userform to have a cell or a
text box or whatever in which I can see the content of a cell in a workbook (i.e. =sheet!2 e10). is it possible? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Yes it's possible. Sub ShowTheForm() frmViewCells.Show vbModeless End Sub Private Sub cmdOK_Click() Dim S2 As Worksheet Set S2 = Sheets(2) Me.txtNo1.Value = S2.Cells(10, 5).Value 'Col E, Row 10 End Sub You could be on Sheet1 looking at a user form and viewing different cells on Sheet2 as I have shown. This just shows a simple example. Is that what you were trying to do? -----Original Message----- hello everybody. I have a question: I need a userform to have a cell or a text box or whatever in which I can see the content of a cell in a workbook (i.e. =sheet!2 e10). is it possible? . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Antonov,
The simplest way to do it with code is: TextBox1.Text = ThisWorkbook.Worksheets("name").Range("A1").Formul a Użytkownik "Antonov" napisał w wiadomości ... hello everybody. I have a question: I need a userform to have a cell or a text box or whatever in which I can see the content of a cell in a workbook (i.e. =sheet!2 e10). is it possible? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there Losmac
where do I have to input the code? I have tried it but nothing happened "losmac" wrote in message ... Hello Antonov, The simplest way to do it with code is: TextBox1.Text = ThisWorkbook.Worksheets("name").Range("A1").Formul a Użytkownik "Antonov" napisał w wiadomości ... hello everybody. I have a question: I need a userform to have a cell or a text box or whatever in which I can see the content of a cell in a workbook (i.e. =sheet!2 e10). is it possible? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Antonov,
You input the code "behind" the cmdOK button. This is how you do it: First make the button on the form. Name it cmdOK (or whatever you would like) in the properties section. Write the caption as "Enter" also in the properties section. Now double click this newly created button. You should see this: Private Sub cmdOK_Click() End Sub Now put Losmac's code or my code in there. Both should work. I hope that helps. Losmac's code is a little different. The text box in this case, is named "TextBox1", instead of "txtNo1". He's referring to a sheet called "name" (rather than the second sheet "Sheet(2)") and a cell at the top-left (rather than at row 10, column E). Also it's written for a "formula" (rather than just a "value"). For fun, you could put both codes in this subroutine like this, with two Text boxes on your form. One text box would be called "TextBox1", and the other one would be called "txtNo1". Make sure one of your Excel workbook worksheets is called "name". This would be the code: Private Sub cmdOK_Click() Dim tw As Workbook Dim S2 As Worksheet Dim NM As Worksheet Set tw = ThisWorkbook Set S2 = tw.Sheets(2) Set NM = tw.Sheets("name") S2.Cells(10, 5).Value = Me.txtNo1.Value NM.Range("A1").Formula = Me.TextBox1.Text End Sub Add a "cmdExit" button to your form. Double click this newly created exit button and put in this code: Private Sub cmdExit_Click() End End Sub Or you could write: Private Sub cmdExit_Click() Unload Me End Sub Rick -----Original Message----- Hi there Losmac where do I have to input the code? I have tried it but nothing happened "losmac" wrote in message ... Hello Antonov, The simplest way to do it with code is: TextBox1.Text = ThisWorkbook.Worksheets("name").Range ("A1").Formula Użytkownik "Antonov" napisał w wiadomości ... hello everybody. I have a question: I need a userform to have a cell or a text box or whatever in which I can see the content of a cell in a workbook (i.e. =sheet!2 e10). is it possible? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform to appear on top? | Excel Discussion (Misc queries) | |||
Userform | Excel Discussion (Misc queries) | |||
userform | New Users to Excel | |||
Userform | Excel Programming | |||
Userform help | Excel Programming |