Airstud From United States of America, joined Nov 2000, 2667 posts, RR: 4 Posted (2 years 4 months 1 day 21 hours ago) and read 1427 times:
I have posted about this in a VBA forum but have not gotten a response and I am an impatient dude so why not go ahead and post it ici:
See, I do not have much experience with the VBA, but I want to write a program part of which will locate a certain row or rows in a spreadsheet that contain certain data in Column X (like "Henson" or "Nguyen" or "Hutchens"); then extract other data from a couple other columns in that row and spit it into a different spreadsheet (and then do the same thing until it's hit all the criterion-satisfying rows).
It seems that the Range.Find method is the way to do this. Am I wrong? VBA's documamentation says that the return value for this method is "A Range object that represents the first cell where that information is found."
The MsgBox says "Henson Stewart". Which is indeed the content of the cell I expected to be found, but "Henson Stewart" is a string o' text. I want a Range object a)because consarn it, that's what the documamentation said I'd get; and 2)because I need to get the row number of this cell so I can copy the other four cells' worth of data out of that row, stick it into my other spreadsheet, and allow my for-next loop to go merrily along.
Does Range.Find actually return a object? When I commented out the MsgBox and used either "Resulticus.Select" or "Resulticus.Activate" I got a runtime error 424 "Object required." So I went into the General/Declarations section of the code editor and did a "Dim Resulticus as Object", and then I got runtime error 91 "Object variable or With block variable not set"
Wha goin' on is...how do I get this Range.Find method to work?