Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Speedy line item entry with Macros

I'm trying to make a quick way to enter a line of data that is NOT repetitive
for time tracking.

I want to click into the first column, then Tab through the rest and have it
either autopopulate the data in the cell, or let me type a couple of letters
to bring up the appropriate menu item from a list:

DATE(auto enter today or allow to type)
HOURS(default to 0.25 but allow free entry)
Select(combo box choice of a few text items)
Select2(another quick-choice list)
Text field(free entry only)
Reference(automatically add one to the field above it)
Select3(another quick-choice list)

Not a complex spreadsheet, but some macros might save me hours per year of
typing considering I have to enter everything I do in the sheet during the
day.

Any help is appreciated as I have no idea where to start other than to fire
up the VB editor.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Speedy line item entry with Macros

Chris

You can use Validation from the Data menu to set up the drop down lists for
your 3 selection columns.

Then in the VBA Project select the relevant sheet and add the following code
to the code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Value = Empty Then
If ActiveCell.Column = 1 Then
ActiveCell.FormulaR1C1 = Date
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Value = 0.25
ElseIf ActiveCell.Column = 6 Then
If ActiveCell.Row = 2 Then
ActiveCell.Value = 1
Else
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
End If
End If
End If

End Sub

This code assumes that you are starting with Date in Column A.

Regards
Rowan

PS If you use FormatCells to unlock all cells in columns 1-7 and then
ToolsProtectionProtect Sheet to protect the sheet, tabbing along a line
will automatically take you to the next line when you get to the end of your
range.

"Chris Leeson" wrote:

I'm trying to make a quick way to enter a line of data that is NOT repetitive
for time tracking.

I want to click into the first column, then Tab through the rest and have it
either autopopulate the data in the cell, or let me type a couple of letters
to bring up the appropriate menu item from a list:

DATE(auto enter today or allow to type)
HOURS(default to 0.25 but allow free entry)
Select(combo box choice of a few text items)
Select2(another quick-choice list)
Text field(free entry only)
Reference(automatically add one to the field above it)
Select3(another quick-choice list)

Not a complex spreadsheet, but some macros might save me hours per year of
typing considering I have to enter everything I do in the sheet during the
day.

Any help is appreciated as I have no idea where to start other than to fire
up the VB editor.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Speedy line item entry with Macros

Sweet thanks Rowan!

"Rowan" wrote:

Chris

You can use Validation from the Data menu to set up the drop down lists for
your 3 selection columns.

Then in the VBA Project select the relevant sheet and add the following code
to the code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Value = Empty Then
If ActiveCell.Column = 1 Then
ActiveCell.FormulaR1C1 = Date
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Value = 0.25
ElseIf ActiveCell.Column = 6 Then
If ActiveCell.Row = 2 Then
ActiveCell.Value = 1
Else
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
End If
End If
End If

End Sub

This code assumes that you are starting with Date in Column A.

Regards
Rowan

PS If you use FormatCells to unlock all cells in columns 1-7 and then
ToolsProtectionProtect Sheet to protect the sheet, tabbing along a line
will automatically take you to the next line when you get to the end of your
range.

"Chris Leeson" wrote:

I'm trying to make a quick way to enter a line of data that is NOT repetitive
for time tracking.

I want to click into the first column, then Tab through the rest and have it
either autopopulate the data in the cell, or let me type a couple of letters
to bring up the appropriate menu item from a list:

DATE(auto enter today or allow to type)
HOURS(default to 0.25 but allow free entry)
Select(combo box choice of a few text items)
Select2(another quick-choice list)
Text field(free entry only)
Reference(automatically add one to the field above it)
Select3(another quick-choice list)

Not a complex spreadsheet, but some macros might save me hours per year of
typing considering I have to enter everything I do in the sheet during the
day.

Any help is appreciated as I have no idea where to start other than to fire
up the VB editor.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Speedy line item entry with Macros

Oh... the reference number column that i wanted to auto-increment isnt really
a number... it has two letters at the beginning followed by 4 numbers

XX1111 format

If I set one like that and then do the excel drag-to-populate thing, it
neatly increases the number part of it by 1, but the macro only does that if
the field is actually a number. Is there a programmatic way to achieve the
same result?

"Rowan" wrote:

Chris

You can use Validation from the Data menu to set up the drop down lists for
your 3 selection columns.

Then in the VBA Project select the relevant sheet and add the following code
to the code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Value = Empty Then
If ActiveCell.Column = 1 Then
ActiveCell.FormulaR1C1 = Date
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Value = 0.25
ElseIf ActiveCell.Column = 6 Then
If ActiveCell.Row = 2 Then
ActiveCell.Value = 1
Else
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
End If
End If
End If

End Sub

This code assumes that you are starting with Date in Column A.

Regards
Rowan

PS If you use FormatCells to unlock all cells in columns 1-7 and then
ToolsProtectionProtect Sheet to protect the sheet, tabbing along a line
will automatically take you to the next line when you get to the end of your
range.

"Chris Leeson" wrote:

I'm trying to make a quick way to enter a line of data that is NOT repetitive
for time tracking.

I want to click into the first column, then Tab through the rest and have it
either autopopulate the data in the cell, or let me type a couple of letters
to bring up the appropriate menu item from a list:

DATE(auto enter today or allow to type)
HOURS(default to 0.25 but allow free entry)
Select(combo box choice of a few text items)
Select2(another quick-choice list)
Text field(free entry only)
Reference(automatically add one to the field above it)
Select3(another quick-choice list)

Not a complex spreadsheet, but some macros might save me hours per year of
typing considering I have to enter everything I do in the sheet during the
day.

Any help is appreciated as I have no idea where to start other than to fire
up the VB editor.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Speedy line item entry with Macros

Try something like

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim intPart As Integer
Dim strPart As String
If ActiveCell.Value = Empty Then
If ActiveCell.Column = 1 Then
ActiveCell.FormulaR1C1 = Date
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Value = 0.25
ElseIf ActiveCell.Column = 6 Then
If ActiveCell.Row = 2 Then
ActiveCell.Value = "XX0001" 'change xx to your letters
Else
intPart = Right(ActiveCell.Offset(-1, 0).Value, 4) + 1
strPart = Left(ActiveCell.Offset(-1, 0).Value, 2)
If intPart < 10 Then
ActiveCell.Value = strPart & "000" & intPart
ElseIf intPart < 100 Then
ActiveCell.Value = strPart & "00" & intPart
ElseIf intPart < 1000 Then
ActiveCell.Value = strPart & "0" & intPart
Else
ActiveCell.Value = strPart & intPart
End If
End If
End If
End If
End Sub


Regards
Rowan

"Chris Leeson" wrote:

Oh... the reference number column that i wanted to auto-increment isnt really
a number... it has two letters at the beginning followed by 4 numbers

XX1111 format

If I set one like that and then do the excel drag-to-populate thing, it
neatly increases the number part of it by 1, but the macro only does that if
the field is actually a number. Is there a programmatic way to achieve the
same result?

"Rowan" wrote:

Chris

You can use Validation from the Data menu to set up the drop down lists for
your 3 selection columns.

Then in the VBA Project select the relevant sheet and add the following code
to the code window:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Value = Empty Then
If ActiveCell.Column = 1 Then
ActiveCell.FormulaR1C1 = Date
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Value = 0.25
ElseIf ActiveCell.Column = 6 Then
If ActiveCell.Row = 2 Then
ActiveCell.Value = 1
Else
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
End If
End If
End If

End Sub

This code assumes that you are starting with Date in Column A.

Regards
Rowan

PS If you use FormatCells to unlock all cells in columns 1-7 and then
ToolsProtectionProtect Sheet to protect the sheet, tabbing along a line
will automatically take you to the next line when you get to the end of your
range.

"Chris Leeson" wrote:

I'm trying to make a quick way to enter a line of data that is NOT repetitive
for time tracking.

I want to click into the first column, then Tab through the rest and have it
either autopopulate the data in the cell, or let me type a couple of letters
to bring up the appropriate menu item from a list:

DATE(auto enter today or allow to type)
HOURS(default to 0.25 but allow free entry)
Select(combo box choice of a few text items)
Select2(another quick-choice list)
Text field(free entry only)
Reference(automatically add one to the field above it)
Select3(another quick-choice list)

Not a complex spreadsheet, but some macros might save me hours per year of
typing considering I have to enter everything I do in the sheet during the
day.

Any help is appreciated as I have no idea where to start other than to fire
up the VB editor.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
speedy way to do array-frequency? Seeker Excel Discussion (Misc queries) 0 April 5th 09 04:03 AM
Line Item Pam Excel Worksheet Functions 2 November 20th 07 10:52 PM
Break one line item into many... Tom Excel Worksheet Functions 2 August 7th 07 02:16 PM
Speedy way to create IF Function H0MELY Excel Worksheet Functions 3 February 10th 06 06:57 AM
speedy way to set values in a range emg178 Excel Programming 2 May 6th 04 08:04 PM


All times are GMT +1. The time now is 09:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"