ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Enetring data in an expanding table (https://www.excelbanter.com/excel-discussion-misc-queries/235391-enetring-data-expanding-table.html)

NDBC

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

Jacob Skaria

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


JLatham

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


Don Guillett

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



NDBC

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



All times are GMT +1. The time now is 11:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com