1

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:

Mixed Game Spreadsheet

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.

braX
11.9k5 gold badges24 silver badges38 bronze badges
asked Oct 25 at 17:11
3
  • Your check for the intersect exits the sub if its negative. You may have a look onto stackoverflow.com/a/27182987/17172829 Commented Oct 25 at 17:18
  • Also will need the Amount Bet to do the same. - Is Amount Bet on column D? Commented Oct 26 at 2:24
  • Since you are working with Worksheet_Change, I would recommend giving THIS a quick look. Commented Oct 26 at 5:02

1 Answer 1

0
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
answered Oct 25 at 17:59
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.