#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default userform

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default userform

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default userform

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default userform

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default userform

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform to appear on top? capt Excel Discussion (Misc queries) 6 February 24th 08 02:53 PM
Userform Jeff Excel Discussion (Misc queries) 1 April 25th 06 07:30 PM
userform carwincarber New Users to Excel 0 October 23rd 05 06:59 PM
Userform John Wilson Excel Programming 2 August 1st 03 06:33 PM
Userform help Lorenzo Excel Programming 1 July 25th 03 01:05 PM


All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Š2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"