I found a great video for VBA to work with timestamps for a poker spreadsheet I'm creating.
The VBA works great. But I need to track mixed games. We may play several out of our 20+ games.
I want just one time column. Right now it tracks the time for games.
I also need the Antes, Blinds column to modify the account. Also will need the Amount Bet to do the same.
What I'll see is a time record for all games where I've been dealt in, what blinds or antes or tips were paid, and if I participated in a hand in any games, what I bet.
Here is a screen shot of the spread sheet:
I've tried adding multiple if blocks, this won't work.
I tried the code for each situation separately, the time stamp does work, here is the code showing both If blocks.
Sorry the display sucks. I'm using the {} tool but it doesn't cleanly represent the code.
Thankfully it's just 20 or so lines and though difficult to read, it's short.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim GameNameRange As Range
Set GameNameRange = Range("B5:B101")
If Intersect(Target, GameNameRange) Is Nothing Then Exit Sub
On Error Resume Next
If Target.Offset(0, -1) = "" Then
Target.Offset(0, -1) = Now
End If
Dim BlindsAntesTipsRange As Range
Set BlindsAntesTipsRange = Range("C5:C101")
If Intersect(Target, BlindsAntesTipsRange) Is Nothing Then Exit Sub
On Error Resume Next
If Target.Offset(0, -2) = "" Then
Target.Offset(0, -2) = Now
End If
End Sub
There's gotta be an easy way to do this.
Thanks for any help.
1 Answer 1
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
If Intersect(Target, Range("B5:C101")) Is Nothing Then Exit Sub
Set cel = Target.Offset(, 1 - Target.Column)
If cel = "" Then cel = Now
End Sub
Also will need the Amount Bet to do the same.- IsAmount Betoncolumn D?Worksheet_Change, I would recommend giving THIS a quick look.