noboffinme
Registered User.
- Local time
- Today, 09:23
- Joined
- Nov 28, 2007
- Messages
- 288
Hi
I have the below code to go through months of data from left to right, row by row & find the first value that is > 0, then copy the records on that row back 6 columns from that value & also forward 6 months & paste into a new worksheet.
I'm stuck on the > 0 value for the 'Cell,Find...' syntax.
Here's the code so far;
Option Explicit
Sub test_range()
Dim i As Integer
Dim FinalRow As Integer
FinalRow = Cells(65536, 1).End(xlUp).Row
Sheets.add().Name = "RESULTS"
For i = 2 To FinalRow
Sheets("Sheet1").Select
Range("B" & i).Select
'----------------------------------------------------------
'Here's (below) where I need to add something like the "ActiveCell > 0" (which doesn't work), what can I put here in the 'What' section to get only values > $0?
'--------------------------------------------------------
Cells.Find(What:=(ActiveCell > 0), After:=Activecell, SearchOrder:=xlByRows, SearchDirection:=xlNext).Select
ActiveCell.Offset(-1, -7).Range("B2:N2").Copy
Sheets("Results").Select
Cells.Range("A" & i).Select
Sheets("Results").Paste
Next i
End Sub
Thanks for any helpful suggestions.
I have the below code to go through months of data from left to right, row by row & find the first value that is > 0, then copy the records on that row back 6 columns from that value & also forward 6 months & paste into a new worksheet.
I'm stuck on the > 0 value for the 'Cell,Find...' syntax.
Here's the code so far;
Option Explicit
Sub test_range()
Dim i As Integer
Dim FinalRow As Integer
FinalRow = Cells(65536, 1).End(xlUp).Row
Sheets.add().Name = "RESULTS"
For i = 2 To FinalRow
Sheets("Sheet1").Select
Range("B" & i).Select
'----------------------------------------------------------
'Here's (below) where I need to add something like the "ActiveCell > 0" (which doesn't work), what can I put here in the 'What' section to get only values > $0?
'--------------------------------------------------------
Cells.Find(What:=(ActiveCell > 0), After:=Activecell, SearchOrder:=xlByRows, SearchDirection:=xlNext).Select
ActiveCell.Offset(-1, -7).Range("B2:N2").Copy
Sheets("Results").Select
Cells.Range("A" & i).Select
Sheets("Results").Paste
Next i
End Sub
Thanks for any helpful suggestions.