ChewDoggie
Programmer
Hello All,
Although I've developed a TON of VB6 code in my life and a good share of C#/VB.NET code, this is my first venture into Excel VBA code.
HR is on my back to finish a VB.NET application I've been working on for 3 months and they want it NOW. Yesterday, I found out that all they really need is a way for the existing Excel Spreadsheet they're using to accurately perform some calculations and they'll get off my back about the .NET app for now (we'll see).
So...I've been given an assignment to modify an Excel spreadsheet that has 5 or 6 dropdown lists on it. The datasheet is used by HR to keep track of Employee attendance.
My VBA Newbie questions are as follows:
1) How do I capture values entered by a user in a cell?
2) In my Visual Basic Editor (Alt+F11), I can see "Sheet" objects and some limited events. Are there other objects besides "Sheet" and are there other events, besides the ones associated with "Sheet" ?
My goal is to be able determine when the focus has left a certain cell, and then capture data from that cell (et al) and do some calcuations with them.
I've created this code so far just to experiment with code I've seen online, but it barfs with "Unable to set the Text Property of the Range class" (and I don't think its behaving as I intend).
BTW, if anyone knows of a good online site (beside a basic Google search) that'll keep me busy for a while, I'd love that too.
Thanks to ALL.
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.
Although I've developed a TON of VB6 code in my life and a good share of C#/VB.NET code, this is my first venture into Excel VBA code.
HR is on my back to finish a VB.NET application I've been working on for 3 months and they want it NOW. Yesterday, I found out that all they really need is a way for the existing Excel Spreadsheet they're using to accurately perform some calculations and they'll get off my back about the .NET app for now (we'll see).
So...I've been given an assignment to modify an Excel spreadsheet that has 5 or 6 dropdown lists on it. The datasheet is used by HR to keep track of Employee attendance.
My VBA Newbie questions are as follows:
1) How do I capture values entered by a user in a cell?
2) In my Visual Basic Editor (Alt+F11), I can see "Sheet" objects and some limited events. Are there other objects besides "Sheet" and are there other events, besides the ones associated with "Sheet" ?
My goal is to be able determine when the focus has left a certain cell, and then capture data from that cell (et al) and do some calcuations with them.
I've created this code so far just to experiment with code I've seen online, but it barfs with "Unable to set the Text Property of the Range class" (and I don't think its behaving as I intend).
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim EnteredReason As String
If ActiveSheet.Range("K1").Select = True Then
EnteredReason = ActiveSheet.Range("K1").Text
ActiveSheet.Range("L1").Text = EnteredReason
End If
End Sub
BTW, if anyone knows of a good online site (beside a basic Google search) that'll keep me busy for a while, I'd love that too.
Thanks to ALL.
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.