+ Reply to Thread
Results 1 to 10 of 10

Help with VBA ARRAY

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Help with VBA ARRAY

    I am relatively new to VBA and I am trying to create an array to compare columns in a worksheet. for example, I want to look through a column with unknown rows and every time I find the word "AUTH" I want to then look at its value which is in another column and paste it to an empy tolumn in the same row.

    Another example is I want to look at more than one column and compare them. Ex) if row says "AUTH" and then another column (same row) says "CANCELLED" then again return value found in another column to blank column.


    Thank you for your help. I hope this isnt completely confusing. I guess i am just having a lot of trouble understanding how to compare arrays or even set them up to be compared.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Help with VBA ARRAY

    I'm not sure you even need an array. Can you paste a sample workbook with a before and after example of what you would like to see?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Help with VBA ARRAY

    Here is an example of some of the code I have created. Problem is it is looping too much and takes forever
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Help with VBA ARRAY

    I am trying to set it up to find the specific rows and columns I am looking for because if extra columns are deleted I want it to continue to run without issue

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Help with VBA ARRAY

    The code you posted seems to do significantly more than what you asked for in your first post. This is where a workbook with a before and after example becomes so useful.
    if extra columns are deleted I want it to continue to run without issue
    This should be no problem, usually if you are deleting rows you can loop backwards and the loop is not effected.

  6. #6
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Help with VBA ARRAY

    Sorry. I know that code was really long. What I am looking for is an example array for one of those loops. If I can get an idea of how to set it up I think ill be able to adapt it for the rest.

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Help with VBA ARRAY

    Well if I take what your OP asks for literally then this:
    Please Login or Register  to view this content.
    Looks in column A for AUTH. If AUTH is found in A and CANCELLED is found in B of same row then it copies Column C of same row to the first empty cell in that row. If cancelled is NOT found in column b then it copies column D of the same row to the first empty cell in that row.

    Clear as mud?

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Help with VBA ARRAY

    It would probably be easier to do a multi-find and then iterate the found range.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Help with VBA ARRAY

    attahced is example. This will contain roughly 25k lines
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Help with VBA ARRAY

    Thanks for the replies. Sorry I was slow in getting an example ready

  11. #11
    Registered User
    Join Date
    02-14-2013
    Location
    arlington
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Help with VBA ARRAY

    Thank again
    Last edited by Ppessina; 08-26-2013 at 04:22 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Loop new messages containing a table, populate a dynamic array, paste array to Excel
    By laripa in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 07:20 AM
  2. [SOLVED] Quick Array question - Copy array to another array then resize?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-02-2013, 01:17 AM
  3. [SOLVED] Excel 2003 Array as input - how to place output in a second array?
    By theelkhunter in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-10-2013, 02:04 PM
  4. [SOLVED] Populate Listbox with all rows of a dynamic array where elements of a single array match.
    By Tayque_J_Holmes in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-07-2012, 04:54 AM
  5. Single Conditional Array x two Multi-Column Array - Approach needed
    By David Brown in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-28-2010, 11:41 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1