Hi all
I am new to vba and need some help. I have copied, modified and tried multiple vba to do the below but can't seem to get one to do all that I need.
I have one workbook with 10 worksheets in. I need my vba to look in all sheets in column L.
If there is a value greater then 3, copy the corresponding cell in column B to sheet 1 but inserting the sheet name in Column A first.
Then check all sheets.
please see my code below, any help will be greatly appreciated.
Sub filldata()
Sheets("Sheet1").Select
Range("A1:A20").Select
Selection.ClearContents
Range("A1").Select
LastRow = Sheet2.Range("L20").End(xlUp).Row
i = 2
j = 1
For i = 2 To LastRow
If Sheet2.Range("H" & i).Value <> 0 Then 'the condition to check
Sheet1.Range("B" & j).Value = Sheet2.Range("A" & i).Value
j = j + 1
End If
Next
End Sub
I am new to vba and need some help. I have copied, modified and tried multiple vba to do the below but can't seem to get one to do all that I need.
I have one workbook with 10 worksheets in. I need my vba to look in all sheets in column L.
If there is a value greater then 3, copy the corresponding cell in column B to sheet 1 but inserting the sheet name in Column A first.
Then check all sheets.
please see my code below, any help will be greatly appreciated.
Sub filldata()
Sheets("Sheet1").Select
Range("A1:A20").Select
Selection.ClearContents
Range("A1").Select
LastRow = Sheet2.Range("L20").End(xlUp).Row
i = 2
j = 1
For i = 2 To LastRow
If Sheet2.Range("H" & i).Value <> 0 Then 'the condition to check
Sheet1.Range("B" & j).Value = Sheet2.Range("A" & i).Value
j = j + 1
End If
Next
End Sub