Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a cell that contains ?? - Log Creation and Updating
I am looking to create a log that has three stages. When the user completes
the first stage the information is written to a spreadsheet on the next empty Row. I know how to do this bit. At a point in the future a different user will then complete stage two and the subsequent information needs to be added to the existing log. I can ensure that any different user links to the same spreadsheet but what I am struggling on is getting the macro to find the right row. The first cell in the row will be a unique identifier that will be present throughout the three stages. So what I am asking is the code for : Search Column A for a cell that contains ABC123. When found select this Row, Column 5, then Column 6 etc etc. I hope that is clear and someone is able to help! Thanks in Advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a cell that contains ?? - Log Creation and Updating
Try the below macro
Sub Macro() Dim varFound As Variant, varSearch As Variant varSearch = "ABC123" Set varRange = Sheets("Sheet1").Columns(1) Set varFound = varRange.Find(varSearch, LookAt:=xlWhole) If Not varFound Is Nothing Then lngLastCol = ActiveSheet.Cells(varFound.Row, _ Columns.Count).End(xlToLeft).Column Cells(varFound.Row, lngLastCol + 1) = "write log" End If End Sub If this post helps click Yes --------------- Jacob Skaria "BaggieDan" wrote: I am looking to create a log that has three stages. When the user completes the first stage the information is written to a spreadsheet on the next empty Row. I know how to do this bit. At a point in the future a different user will then complete stage two and the subsequent information needs to be added to the existing log. I can ensure that any different user links to the same spreadsheet but what I am struggling on is getting the macro to find the right row. The first cell in the row will be a unique identifier that will be present throughout the three stages. So what I am asking is the code for : Search Column A for a cell that contains ABC123. When found select this Row, Column 5, then Column 6 etc etc. I hope that is clear and someone is able to help! Thanks in Advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a cell that contains ?? - Log Creation and Updating
Example code:
Dim rng As Range, sh As Worksheet Set sh = Sheets("Somesheet") Set rng = sh.Range("A2", sh.Cells(Rows.Count, 1). End(xlUp)) Set newRng = rng.Find(ABC123, LookIn:=xlValues) Set col5 = newRng.Offset(0, 4) Set col6 = newRng.Offset(0, 5) col5.Select col6.Select "BaggieDan" wrote in message ... I am looking to create a log that has three stages. When the user completes the first stage the information is written to a spreadsheet on the next empty Row. I know how to do this bit. At a point in the future a different user will then complete stage two and the subsequent information needs to be added to the existing log. I can ensure that any different user links to the same spreadsheet but what I am struggling on is getting the macro to find the right row. The first cell in the row will be a unique identifier that will be present throughout the three stages. So what I am asking is the code for : Search Column A for a cell that contains ABC123. When found select this Row, Column 5, then Column 6 etc etc. I hope that is clear and someone is able to help! Thanks in Advance |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a cell that contains ?? - Log Creation and Updating
Thanks to you both, I don't like asking for code without having a go first
but that, as simple as it now seems, had me stumped for a while. Cheers! "JLGWhiz" wrote: Example code: Dim rng As Range, sh As Worksheet Set sh = Sheets("Somesheet") Set rng = sh.Range("A2", sh.Cells(Rows.Count, 1). End(xlUp)) Set newRng = rng.Find(ABC123, LookIn:=xlValues) Set col5 = newRng.Offset(0, 4) Set col6 = newRng.Offset(0, 5) col5.Select col6.Select "BaggieDan" wrote in message ... I am looking to create a log that has three stages. When the user completes the first stage the information is written to a spreadsheet on the next empty Row. I know how to do this bit. At a point in the future a different user will then complete stage two and the subsequent information needs to be added to the existing log. I can ensure that any different user links to the same spreadsheet but what I am struggling on is getting the macro to find the right row. The first cell in the row will be a unique identifier that will be present throughout the three stages. So what I am asking is the code for : Search Column A for a cell that contains ABC123. When found select this Row, Column 5, then Column 6 etc etc. I hope that is clear and someone is able to help! Thanks in Advance . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
calculator creation, find missing value | Excel Worksheet Functions | |||
Date Creation in Cell | Excel Worksheet Functions | |||
Day before creation date in cell or as sheet name | Excel Programming | |||
Creation date in cell | Excel Programming | |||
Creation date in cell | Excel Programming |