Note that there are some explanatory texts on larger screens.

plurals
  1. POI am having trouble finding a column value and relating it to the corresponding row number in vba Excel2007
    primarykey
    data
    text
    <p>First, I am using Excel 2007, and working in the Visual Basic editor(VBA, I believe).</p> <p>I am attempting to take a sheet of data(7500 rows), reduce it to 2999 rows and format it to begin at a InitialValue (0.2) from column "F", I want the InitialValue to be defined as the Row number. All values in all rows prior to the first occurrence of 0.2 in column "F" can then be deleted. Then I want to begin with the new row 1, and shorten the file to 2999 rows.</p> <p>Column F is a data counter that sometimes resets due to a peculiar motion sensor input, and thus i would like to only find the first reference in the data set to the prescribed InitialValue of (0.2). I am uncertain if i need to code a strategy for this.</p> <p>the sheet is of the format:</p> <pre><code>ROW | A | B | C | D 1 date-time data data 599.4 2 date-time data data 599.6 3 date-time data data 599.8 4 date-time data data 0.2 5 date-time data data 0.4 6 date-time data data 0.6 7 date-time data data 0.8 . date-time data data 1.0 . date-time data data 0.2 . date-time data data 0.4 7500 date-time data data 345.4 </code></pre> <p>I am fairly new to VBA, so i am surely missing something important here. I get an object required error at the "Set InitialValue" line</p> <pre><code> Sub Scrub_clean() 'Scrub_clean Macro isolates event Dim InitialValue As Integer Set lookupTable = Worksheets("Sheet1").Range("D1:D7500") With Worksheets(1).Range("D1:D7500").Value Set InitialValue = .Find(0.2, LookIn:=xlValues) End With Rows("1:InitialValue-1").Select 'subtract one from initial value to ensure the 0.2 value does not get deleted Selection.Delete Shift:=xlUp Rows("3000:7500").Select Selection.Delete End Sub </code></pre> <p>I am having no success with getting to the definition of the first occurrence of the 0.2 in column "D", and am not sure where to start to ensure the macro does not keep looking for other occurrences of that same value. Any help would be greatly appreciated. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload