Results 1 to 4 of 4

Thread: [RESOLVED] Easy question...probably has to do with arrays

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    67

    Resolved [RESOLVED] Easy question...probably has to do with arrays

    Hey guys, I always code this the hard way...want to do it the easy way this time so I was hoping someone could let me in on the secret. Without knowing the right verbiage its always hard to find what I need doing a search.

    I've got a spreadsheet in excel, and one of the columns has branch codes in it. For every row that has a branch code of AI, FI, FJ, etc etc (18 total branch codes) I need to delete it. The way I know how to do that is like this:

    Code:
    ROW = 2
    WHILE NOT .CELLS(ROW,2).VALUE = ""
         BR_CODE = .CELLS(ROW,2).VALUE
           IF BR_CODE = "AI" THEN
              .ROWS(ROW).DELETE
           END IF
           IF BR_CODE = "FI" THEN
              .ROWS(ROW).DELETE
           END IF
           IF BR_CODE = "FJ" THEN
              .ROWS(ROW).DELETE
              ROW = ROW - 1
           END IF
    'ETC. FOR ALL 18 BRANCHES.
    ROW = ROW + 1
    WEND
    I normally just do it that way, because its quicker to copy & paste than it is to find the right answer. But I don't want my code to look sloppy anymore, so whats the right way? People talk about arrays all the time...I've never used one. Can someone show me an example as it would apply to this scenario?

    *EDIT* that code wouldn't actually work quite right because it would skip a row after each one it deletes...but you get the idea of what I'm trying to do...
    Last edited by Bill-E-BoB; Mar 28th, 2007 at 07:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width