MarktheShark
New Member
- Joined
- Feb 16, 2021
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
Hi everyone, I want to automate manual handling in VBA but ran into some issues. Hopefully, you can help me with this.
In general:
In column "temp" I set a "x" and a lookup formula checks if in column "ID" is the same value. If there is the same value then copy this to column "Copy value founded ID".
The next step is to delete the "x" in "temp" column and go to the next row.
The only thing I want to automate is this:
- set an "x" to fifth row in column "temp"
- look if there is a value found in column "Found ID"
- If so then copy found value to the next column "Copy value founded ID" and the SAME row
- delete the "x" in "temp" column
- go to the next row and repeat above
Code so far:
Sub Find_ID()
Dim wb As Workbook
Dim ws As Worksheet
Dim FoundCell As Range
Set wb = ActiveWorkbook
Set ws = ActiveSheet
Set WHAT_TO_FIND = Range("B2")
For x = 5 To 10
Range("A" & x).Value = "x"
Set FoundCell = ws.Range("C3:C100").Find(what:=WHAT_TO_FIND)
If Not FoundCell Is Nothing Then
'copy to next column - same row
End If
Next x
End Sub
Table:
In general:
In column "temp" I set a "x" and a lookup formula checks if in column "ID" is the same value. If there is the same value then copy this to column "Copy value founded ID".
The next step is to delete the "x" in "temp" column and go to the next row.
The only thing I want to automate is this:
- set an "x" to fifth row in column "temp"
- look if there is a value found in column "Found ID"
- If so then copy found value to the next column "Copy value founded ID" and the SAME row
- delete the "x" in "temp" column
- go to the next row and repeat above
Code so far:
Sub Find_ID()
Dim wb As Workbook
Dim ws As Worksheet
Dim FoundCell As Range
Set wb = ActiveWorkbook
Set ws = ActiveSheet
Set WHAT_TO_FIND = Range("B2")
For x = 5 To 10
Range("A" & x).Value = "x"
Set FoundCell = ws.Range("C3:C100").Find(what:=WHAT_TO_FIND)
If Not FoundCell Is Nothing Then
'copy to next column - same row
End If
Next x
End Sub
Table:
ID | |||
1 | |||
temp | ID | Found ID | Copy value founded ID |
x | 1 | ||
2 | |||
3 | |||
4 | |||
5 | |||
6 | 1 | ||
7 |