index > Visual Basic for Applications (VBA) > loop problem

loop problem


Hi! I have a problem with a loop. I want to search the entire spreadsheet for a cell that contains the text ?Sec type?? However there are two rows that I do not want to search. These to rows are: segment.row and secID.row. These two rows each contains a cell with the text ?Sec type?? Thus, I want to search for any additional cells with that text. If an additional cell containing the text ?Sec type??is found I want to store the address of that cell in the variable c. If no additional cell is found I want to set c = Nothing or something that indicates that no additional cells were found.

AndersBank

Hi

A quick fix would be to dim a new variable d and set it equal to c if your test (c.Address <> firstAddress And (c.row = segment.row Or c.row = secID.row)) is true. Then use d in your code.




ADG
ADG

Hello Anders,

You may have solved this already but if not I think you need a way to differenciate the rows that you want to exclude from the search. If your sheet is static and values remain in their respective rows then you can use the row number to check if the results should be recorded. Or even if the value is bold or at least something that you can check in you loop that's says this shouldn't be included carry on.




www.dsmyth.net/blog
Derek Smyth
reply 3

You can use google to search for other answers

 

More Articles

• Office 97 / Windows 2000 Compatability
• Convert UTC date to mm/dd/yyyy hh-mm-ss
• Access Project and Views
• VBA6.4 sdk issues
• Please Help!! Excel driving me mad!
• Determine if a file is already open by another user
• HTTP request - simple problem
• Code erroring out.
• Calling procedure upon deactivate
• Running a macro at a certain time
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• how to add CheckBox?
• Making the templated document the active
• For Each & Variable Problem
• How to install MS Jet 4.0 OLE DB?
• Check diff
• Retrieve IBM Workplace Forms data into E
• how to read merged cells?
• Dialog Sheet not showing up
• dim as new object at form level or just
• updating an Visio OLE object on an Acces
• jump to other slides of a ppt by selecti
• Access and VBA application in the mdb file
• Microsoft Access 2002 printer dialog
• overflow error 6
• Substitute/Replace

Hot Articles

• OWC10 Chart to print on a report
• VBA code in Dutch
• Using user form to create list of files
• Getting Images embedded in Word
• VBA eBook
• dbclick listbox additem
• passing data from a form to a module
• Excel VBA using ADO
• SendKeys from Excel
• Check diff
• access - importing specific data from ex
• Tic Tac Toe Game
• menu tiems for OutputToText, OutputToExc
• Run Time Error 1004 On Long Running Stor
• Newbie - Sending mail via Excel

Recommend Articles

• How can filter object ?
• A Control's Visible property does make t
• Is VBA SDK free and ...?
• Problem with Applying Filter in MS Proje
• How to create a script for creation of d
• Read data from excel through VB.NET
• Novice VBA user trying to consolidate in
• Excel VBA using ADO
• Using Inet to download an FTP File
• Memory profilers
• so lost and buried in help printouts
• INserting custom fields in Word
• how to convert excel to tiff file using
• Writing To Text File Without Quotes
• Why Excel 2003 keeps PivotItems with zer