|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
I am importing information into Excel from another program in the form of two columns, one with strings and one with numbers. Basically I want to read the contents of each cell in the column with strings, assign the first character of the string to a variable, and test this variable against the letter "A". If the it doesn't start with A I want to delete the row. Here is a summary:
For Loop to go through all the rows in column 3 Get string from active cell Assign first character of string to a variable IF variable != 'A' delete row and shift up
For example: the active cell reads "L1". I want to a variable that is assigned to 'L' and test it against the character 'A'. Obviously they're not the same so now I need to delete the row.
The For loop is another problem. The number of rows is not set so it changes with every set of info I import into Excel. How do I determine the upper bound for the loop? Any help would be wonderful. Thanks!
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0022_01C6A0E9.7EC74310 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit
Dear Nina:
Is this an operation that you're trying to import into MS Access or Import in MS Excel?
This forum is for MS Access questions.
If you're trying to do this in MS Access, you would simply link the MS Excel Sheet to MS Access and then use an Append Query to filter out all the unwanted rows.
Joe P.
-----Original Message----- From: Nina [mailto:Nina[ at ]discussions.microsoft.com] Posted At: Thursday, July 06, 2006 9:51 AM Posted To: microsoft.public.access.macros Conversation: Get and manipulate data from cells Subject: Get and manipulate data from cells
I am importing information into Excel from another program in the form of two columns, one with strings and one with numbers. Basically I want to read the contents of each cell in the column with strings, assign the first character of the string to a variable, and test this variable against the letter "A". If the it doesn't start with A I want to delete the row. Here is a summary:
For Loop to go through all the rows in column 3 Get string from active cell Assign first character of string to a variable IF variable != 'A' delete row and shift up
For example: the active cell reads "L1". I want to a variable that is assigned to 'L' and test it against the character 'A'. Obviously they're not the same so now I need to delete the row.
The For loop is another problem. The number of rows is not set so it changes with every set of info I import into Excel. How do I determine the upper
bound for the loop? Any help would be wonderful. Thanks!
------=_NextPart_000_0022_01C6A0E9.7EC74310 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 6.5.7036.0"> <TITLE>Re: Get and manipulate data from cells</TITLE> </HEAD> <BODY> <!-- Converted from text/plain format -->
<P><FONT SIZE=3D2>Dear Nina:</FONT> </P>
<P><FONT SIZE=3D2>Is this an operation that you're trying to import into = MS Access or Import in MS Excel?</FONT> </P>
<P><FONT SIZE=3D2>This forum is for MS Access questions.</FONT> </P>
<P><FONT SIZE=3D2>If you're trying to do this in MS Access, you would = simply link the MS Excel Sheet to MS Access and then use an Append Query = to filter out all the unwanted rows.</FONT></P>
<P><FONT SIZE=3D2>Joe P.</FONT> </P> <BR>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Nina [<A = HREF=3D"mailto:Nina[ at ]discussions.microsoft.com">mailto:Nina[ at ]discussions.mi= crosoft.com</A>] </FONT>
<BR><FONT SIZE=3D2>Posted At: Thursday, July 06, 2006 9:51 AM</FONT>
<BR><FONT SIZE=3D2>Posted To: microsoft.public.access.macros</FONT>
<BR><FONT SIZE=3D2>Conversation: Get and manipulate data from = cells</FONT>
<BR><FONT SIZE=3D2>Subject: Get and manipulate data from cells</FONT> </P>
<P><FONT SIZE=3D2>I am importing information into Excel from another = program in the form of two </FONT>
<BR><FONT SIZE=3D2>columns, one with strings and one with numbers. = Basically I want to read the </FONT>
<BR><FONT SIZE=3D2>contents of each cell in the column with strings, = assign the first character </FONT>
<BR><FONT SIZE=3D2>of the string to a variable, and test this variable = against the letter "A". </FONT>
<BR><FONT SIZE=3D2>If the it doesn't start with A I want to delete the = row. Here is a summary:</FONT> </P>
<P><FONT SIZE=3D2>For Loop to go through all the rows in column 3 = </FONT>
<BR><FONT SIZE=3D2> Get string from active cell</FONT>
<BR><FONT SIZE=3D2> Assign first character of string to a = variable</FONT>
<BR><FONT SIZE=3D2> IF variable !=3D 'A'</FONT>
<BR><FONT SIZE=3D2> delete row and shift = up</FONT> </P> <BR>
<P><FONT SIZE=3D2>For example: the active cell reads "L1". I = want to a variable that is </FONT>
<BR><FONT SIZE=3D2>assigned to 'L' and test it against the character = 'A'. Obviously they're not </FONT>
<BR><FONT SIZE=3D2>the same so now I need to delete the row.</FONT> </P>
<P><FONT SIZE=3D2>The For loop is another problem. The number of rows is = not set so it changes </FONT>
<BR><FONT SIZE=3D2>with every set of info I import into Excel. How do I = determine the upper </FONT>
<BR><FONT SIZE=3D2>bound for the loop? Any help would be wonderful. = Thanks!</FONT> </P>
</BODY> </HTML> ------=_NextPart_000_0022_01C6A0E9.7EC74310--
|
|
|