VB Active Cell problem

5 pts.
Tags:
Excel macros
Microsoft Excel
VB
Visual Basic
I am a vb problem. On an excel sheet, I am trying to have a macro run when the user selects a changing column's active cell. For columns F to I on Sheet!Data, if you choose any cell in range (F9:I65000), then take the value of Column B in the selected row and make as my "Dept" Value. Can anyone help?
ASKED: March 30, 2009  3:34 PM
UPDATED: February 22, 2010  11:10 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try putting this in your worksheets code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Column = 6 Then
If ActiveCell.Row >= 1 And ActiveCell.Row <= 65000 Then
Range(“Dept”).Value = Range(“B” & ActiveCell.Row)
End If
End If

End Sub

This assumes that you have a named cell called Dept

Hope this helps

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • RICPickles
    [...] VB active cell problem [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following