HELP!

  • Thread starter Thread starter bullandbear1987
  • Start date Start date
B

bullandbear1987

I am trying to finish writing some simple program.

My problem is that when I try and change the arguement from SELECTION
CHANGE to CHANGE, it doesn't work. Can someone help?

Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Sheet3").Range("B3").Value = 2 Then
Worksheets("Sheet1").Range("F3") =
Worksheets("Sheet3").Range("F4").Value
End Sub


My second problem is that I would like my data rather than appearing in
a cell, appear in a TEXT BOX. What do I do?
 
I think you're posting to the wrong newsgroup -- this one is for Access,
the database program in MS Office. I suggest you post to an Excel
newsgroup. (However, see below for my answer to your question.)
I am trying to finish writing some simple program.

My problem is that when I try and change the arguement from SELECTION
CHANGE to CHANGE, it doesn't work. Can someone help?

Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Sheet3").Range("B3").Value = 2 Then
Worksheets("Sheet1").Range("F3") =
Worksheets("Sheet3").Range("F4").Value
End Sub

It worked just fine when I tried it. I changed [Sheet1]!A4 by storing a
value of 4 there, and when I moved to another cell, [Sheet1]!F3 got its
new value. Are you sure you connected your procedure to [Sheet1]? I
assume it's intended to be a [Sheet1] event handler, isn't it?

Some code that I sued to run this follows, the first to activate the events:

Sub Macro1()
'
' Keyboard Shortcut: Ctrl+Shift+L
'
Application.EnableEvents = True

End Sub 'Macro1()
My second problem is that I would like my data rather than appearing in
a cell, appear in a TEXT BOX. What do I do?

Here's what I did (after attaching a text box to Sheet1):

Private Sub Worksheet_Change(ByVal Target As Range)

Dim NewValue As String 'Value in changed cell

If Worksheets("Sheet3").Range("B3").Value = 2 Then

'Don't let our changing Sheet1 rerun this event
Application.EnableEvents = False

NewValue = Worksheets("Sheet3").Range("F4").Value

Worksheets("Sheet1").Range("F3") = NewValue

Worksheets("Sheet1").TextBox1.Text = NewValue

Application.EnableEvents = True

End If 'Worksheets("Sheet3")...

End Sub 'Worksheet_Change()


-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 
Back
Top