Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default Enetring data in an expanding table

This is my table


Rider Lap 1 Lap2 ........

100
101
102


I need to select the cell to store data in based on rider number and then
the first free lap time cell. ie. lap 1 time in lap1 and then when get to
next lap determine next available cell over and put lap2 time. If it helps
rider is in column h and 100 is in row 5.

Thanks yet again
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Enetring data in an expanding table

The below code identifies the next free column in the current row..where the
cell is selected...and input the time.

lngCol = ActiveSheet.Cells(ActiveCell.Row, _
Columns.Count).End(xlToLeft).Column + 1
ActiveSheet.Cells(ActiveCell.Row,lngCol) = Now()

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

This is my table


Rider Lap 1 Lap2 ........

100
101
102


I need to select the cell to store data in based on rider number and then
the first free lap time cell. ie. lap 1 time in lap1 and then when get to
next lap determine next available cell over and put lap2 time. If it helps
rider is in column h and 100 is in row 5.

Thanks yet again

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Enetring data in an expanding table

This could be assigned to a button to ask for the lap time and rider number
and will put the lap time in the 1st available column when the rider number
match is made:

Sub AddLaps()
Dim ridersRange As Range
Dim riderCell As Range
Dim lapTime As String
Dim riderNumber As String

lapTime = InputBox$("Enter lap time", "Lap Time", "")
riderNumber = InputBox$("Enter Rider Number", "Rider", "")
If lapTime = "" Or riderNumber = "" Then
Exit Sub
End If
Set ridersRange = Range("H5:" & _
Range("H" & Rows.Count).End(xlUp).Address)
Set riderCell = ridersRange.Find(riderNumber, , xlValues)
If Not riderCell Is Nothing Then
Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = lapTime
End If
Set ridersRange = Nothing
Set riderCell = Nothing
End Sub


"Jacob Skaria" wrote:

The below code identifies the next free column in the current row..where the
cell is selected...and input the time.

lngCol = ActiveSheet.Cells(ActiveCell.Row, _
Columns.Count).End(xlToLeft).Column + 1
ActiveSheet.Cells(ActiveCell.Row,lngCol) = Now()

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

This is my table


Rider Lap 1 Lap2 ........

100
101
102


I need to select the cell to store data in based on rider number and then
the first free lap time cell. ie. lap 1 time in lap1 and then when get to
next lap determine next available cell over and put lap2 time. If it helps
rider is in column h and 100 is in row 5.

Thanks yet again

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Enetring data in an expanding table

How about a drop down list tied to a macro to find the selection and then
find the 1st free column?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"NDBC" wrote in message
...
This is my table


Rider Lap 1 Lap2 ........

100
101
102


I need to select the cell to store data in based on rider number and then
the first free lap time cell. ie. lap 1 time in lap1 and then when get to
next lap determine next available cell over and put lap2 time. If it helps
rider is in column h and 100 is in row 5.

Thanks yet again


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default Enetring data in an expanding table

Thanks,
Just what I needed.

"JLatham" wrote:

This could be assigned to a button to ask for the lap time and rider number
and will put the lap time in the 1st available column when the rider number
match is made:

Sub AddLaps()
Dim ridersRange As Range
Dim riderCell As Range
Dim lapTime As String
Dim riderNumber As String

lapTime = InputBox$("Enter lap time", "Lap Time", "")
riderNumber = InputBox$("Enter Rider Number", "Rider", "")
If lapTime = "" Or riderNumber = "" Then
Exit Sub
End If
Set ridersRange = Range("H5:" & _
Range("H" & Rows.Count).End(xlUp).Address)
Set riderCell = ridersRange.Find(riderNumber, , xlValues)
If Not riderCell Is Nothing Then
Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = lapTime
End If
Set ridersRange = Nothing
Set riderCell = Nothing
End Sub


"Jacob Skaria" wrote:

The below code identifies the next free column in the current row..where the
cell is selected...and input the time.

lngCol = ActiveSheet.Cells(ActiveCell.Row, _
Columns.Count).End(xlToLeft).Column + 1
ActiveSheet.Cells(ActiveCell.Row,lngCol) = Now()

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

This is my table


Rider Lap 1 Lap2 ........

100
101
102


I need to select the cell to store data in based on rider number and then
the first free lap time cell. ie. lap 1 time in lap1 and then when get to
next lap determine next available cell over and put lap2 time. If it helps
rider is in column h and 100 is in row 5.

Thanks yet again

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
Expanding and decreasing data CDH Excel Discussion (Misc queries) 1 August 14th 08 07:40 PM
Expanding a data table to include an extra row HRobinson Excel Discussion (Misc queries) 1 July 7th 08 09:20 AM
Counting Last n Rows in Expanding Table [email protected] Excel Discussion (Misc queries) 9 October 29th 07 03:41 PM
Expanding data Excels Cracking me up! Excel Worksheet Functions 2 November 9th 05 02:07 PM
Excel formula in an expanding table Keady Excel Discussion (Misc queries) 1 July 30th 05 05:03 PM


All times are GMT +1. The time now is 10:53 AM.

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"