It is late and I think my brain is fried. Any input/assistance is greatly appreciated.
I have some code that looks for a specific value in column A, once found, then it copies other values horizontally in the same row of the located value.
Example: Value is 195263, it is found in Column A in Row 35. It then copies other values to column B, C, D, ..... AJ, all in row 35.
However, I need to add an additional clause where if the value is NOT found in column A, then in the next empty cell in column A, it pastes the value and then copies other values horizontally in the same row.
Example: Value is 195263, it is not in Column A. The next empty cell in Column A is 173, it copies the value (195263) to cell address A173, and then copies other values to column B, C, D, ..... AJ, all in row 173.
Here is the relevant snippet of the code I have been using:
Any thoughts/ideas/suggestions, on what/how I can adjust the code so if the Unique_ID is not found in Column A, it then goes to the next empty cell in Column A, pastes the Unique_ID, and then copies the other values to B, C, D, .... AJ, all in the same row?
-Spydey
I have some code that looks for a specific value in column A, once found, then it copies other values horizontally in the same row of the located value.
Example: Value is 195263, it is found in Column A in Row 35. It then copies other values to column B, C, D, ..... AJ, all in row 35.
However, I need to add an additional clause where if the value is NOT found in column A, then in the next empty cell in column A, it pastes the value and then copies other values horizontally in the same row.
Example: Value is 195263, it is not in Column A. The next empty cell in Column A is 173, it copies the value (195263) to cell address A173, and then copies other values to column B, C, D, ..... AJ, all in row 173.
Here is the relevant snippet of the code I have been using:
VBA Code:
Sub Single_UID
Dim Unique_ID As Long
Dim wbL As Workbook
Dim wsL As Worksheet
Set wbL = Workbooks("Log.xlsm")
Set wsL = wbL.Worksheets("Log")
With wsL
Set Findrow = .Range("Unique_ID").Find(What:=Unique_ID, LookIn:=xlValues, LookAt:=xlWhole)
If Not Findrow Is Nothing Then
FirstAddress = Findrow.Address
Do
Findrow.Offset(, 1).Value = Format(Now(), "mm/dd/yyyy")
...
...
...
...
Findrow.Offset(, 35).Value = Condition
Exit Do
Set Findrow = .Range("Unique_ID").FindNext(Findrow)
Loop While Not Findrow Is Nothing And Findrow.Address <> FirstAddress
End If
End With
End Sub
Any thoughts/ideas/suggestions, on what/how I can adjust the code so if the Unique_ID is not found in Column A, it then goes to the next empty cell in Column A, pastes the Unique_ID, and then copies the other values to B, C, D, .... AJ, all in the same row?
-Spydey