+ Reply to Thread
Results 1 to 2 of 2

Array - Searching a column for the right values - display the values on next sheet

  1. #1
    Registered User
    Join Date
    08-20-2013
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    1

    Question Array - Searching a column for the right values - display the values on next sheet

    Hi,

    It was a very long time since I was here and now I'm totally lost!

    I have never really learned the "Array"-thing, I have often used others macros - great, but not if you need to write one yourself and don't get it. This one should be really easy but I do not get the principal.

    I have a range ("Skus") with approx. 2000 rows (1 column) with sku numbers (can vary). I only want to copy those sku numbers, which are 4 digits long, to another range. I Think this should be done with an array since it's fast - how do I do it, can someone explain this really easy ;-).


    This is what I tried but it doesn't work and I do not know where to put "if len(...) = 4 then" and how to publish it etc etc...

    Sub GetSkus()

    Dim wsSheet As Worksheet
    Dim rnRange As Range
    Dim vaData As Variant
    Dim i As Integer

    Set wsBlad = Worksheets("Product")
    Set rnRange = wsSheet.Range("Skus")

    vaData = rnRange.Value

    For i = 1 To UBound(vaData)
    vaData(i, 1) = vaData(i + 1, 1)
    Next i

    Range("Active_Skus").Value = vaData

    End Sub

    Thanks // PiJay

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Array - Searching a column for the right values - display the values on next sheet

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. [SOLVED] compare values from 2 columns and display the unique values in other column
    By smatbis in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-20-2017, 09:58 AM
  2. Replies: 3
    Last Post: 09-10-2014, 09:39 PM
  3. Replies: 3
    Last Post: 01-24-2013, 12:20 PM
  4. [SOLVED] Pick unique values in column A and display the corresponding values from column B & C
    By nostra in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-17-2013, 01:51 AM
  5. Display an array of values from a column range
    By alexandruc in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-12-2012, 03:06 PM
  6. Display Values of Column/Range/Array/Other
    By Laelsa in forum Excel General
    Replies: 1
    Last Post: 11-21-2008, 08:42 PM
  7. Display Values of Column/Range/Array/Other
    By Laelsa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-21-2008, 03:06 PM

Tags for this Thread

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