Results 1 to 2 of 2

Get Array Value and then subtracting array value in 2 column , multiple array value.

Threaded View

  1. #1
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Get Array Value and then subtracting array value in 2 column , multiple array value.

    Is there someone can help me on how to get array value ? I need to subtract 2 cell and put the result in the cell also.
    Same with multiplication procedure. I did try searching but because I am new in using array I have a hard time to settle the issue in my code urgently.

    Kindly see attached file. sheet1 is the preliminary format while sheet2 will be the correct result once code was executed. Below is my code also. Thank you for your help.

    Private Sub CommandButton1_Click()
    Dim vDB, vR()
        Dim i As Long, n As Long, k As Long, j As Integer
        Dim r As Integer
        Dim s As String
        Dim Formula As Integer
        
        vDB = Range("A2", "K" & Range("A" & Rows.Count).End(xlUp).Row)
        n = UBound(vDB, 1)
    
        For i = 1 To n
            If vDB(i, 6) = "LB" Then
                r = 2
            Else
                r = 1
            End If
            k = k + r
            ReDim Preserve vR(1 To 11, 1 To k)
            s = vDB(i, 7)
            For j = 1 To 11
                If r = 1 Then
                    vR(j, k) = vDB(i, j)
                Else
                    vR(j, k - 1) = vDB(i, j)
                    vR(j, k) = vDB(i, j)
                End If
            Next j
            If r = 2 Then
                vR(6, k - 1) = "comp"
                vR(6, k) = "comp"
                vR(8, k) = Split(s, "/")(1)  '15
                vR(9, k) = Split(s, "X")(1)  '150
                MsgBox vR(9, k)
                vR(11, k) = Empty
            End If
        Next i
        Range("f1") = "Type"
        Range("a2").Resize(k, 11) = WorksheetFunction.Transpose(vR)
    End Sub
    Attached Files Attached Files
    Last edited by Yajson; 01-02-2018 at 11:52 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] how can i make this array change the cell in a column based on a text array
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2016, 09:44 AM
  2. [SOLVED] Find cell in 2nd array using row and column from the first array Excel 2010 VBA
    By crywolf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2015, 02:12 PM
  3. Replies: 6
    Last Post: 09-25-2013, 10:08 PM
  4. [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
  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