detweiler
Board Regular
- Joined
- Aug 2, 2013
- Messages
- 60
I use a workbook to track the requests I receive & process, as well as everything else I do in a given day so that at the end of the week I can refresh the pivot table to use the totals to report on. It's a bit of an archaic system I report into with categories and related activities and was looking around to find how to automate the text entries into the worksheet based on the category, related activity and optional reference.
I was able to get the text piece to work in the specific / wanted cells, but ran into a snag when looking to adding time as part of the macro. The bigger snag, because I don't know best coding practices, is where I read on a couple of pages how using the Select or Selection function is not the best way to do what I'm wanting to do, but then really didn't describe the best way to accomplish what I'm trying to without doing that. So, here's what I had come up with the piece for the time entry -- note here about that, I thought it odd that after I typed in Time, the editor changed it to time.
So, it's a two parter --
I was able to get the text piece to work in the specific / wanted cells, but ran into a snag when looking to adding time as part of the macro. The bigger snag, because I don't know best coding practices, is where I read on a couple of pages how using the Select or Selection function is not the best way to do what I'm wanting to do, but then really didn't describe the best way to accomplish what I'm trying to without doing that. So, here's what I had come up with the piece for the time entry -- note here about that, I thought it odd that after I typed in Time, the editor changed it to time.
VBA Code:
Sub CatOneActOneStart()
Cells(Selection.Row, "B").Select
Selection.Value = time
ActiveCell.Offset(0, 1).Select
Selection.Value = "csActivity"
ActiveCell.Offset(0, 1).Select
Selection.Value = "dept activities"
ActiveCell.Offset(0, 1).Select
Selection.Value = ""
End Sub
So, it's a two parter --
- If there's a better way of doing, can you please show me?
- Any idea why the editor changed Time to time and how do I get the current time to be inserted in the cell?
Last edited: