+ Reply to Thread
Results 1 to 6 of 6

VBA sub procedure

Hybrid View

  1. #1
    Registered User
    Join Date
    02-11-2020
    Location
    Nairobi, kenya
    MS-Off Ver
    ms2013
    Posts
    3

    VBA sub procedure

    Attached please find the macrofile.

    I'm trying to use the above procedure to fill a summary table that contains columns with values for input1,2,&3 and the output section which should contain calculated figures after applying calcmacro.

    kindly assist.
    Attached Files Attached Files
    Last edited by paul_karanu; 02-11-2020 at 08:29 AM. Reason: code tags

  2. #2
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: VBA sub procedure

    Since you have had no reply i think maybe you need to be more specific regarding what you want. maybe create a tab looking exactly like you require.
    Also some background as to what this is about might help.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  3. #3
    Registered User
    Join Date
    02-11-2020
    Location
    Nairobi, kenya
    MS-Off Ver
    ms2013
    Posts
    3

    Re: VBA sub procedure

    i have attached a summary table in sheet two.The task is calcmacro procedure works a small procedure
    in a larger procedure('creating small procedures in your macro and calling them in the larger procedure')
    The task is how to call calcmacro and calculate values of other inputs (1,2,3) as seen from the summary
    table in sheet2.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: VBA sub procedure

    try this run on the summary table sheet

    Sub CalcMacro()
    lastrowx = Cells(Rows.Count, "A").End(xlUp).Row
    For j = 3 To lastrowx
        For i = 1 To 20
           Cells(j, i + 4) = (3 - i) * Cells(j, 2) + (2 + 2 * i) * Cells(j, 3) - Cells(j, 4)
        Next i
        Next
    End Sub

  5. #5
    Registered User
    Join Date
    02-11-2020
    Location
    Nairobi, kenya
    MS-Off Ver
    ms2013
    Posts
    3

    Re: VBA sub procedure

    thanks scottiex. However this does not use the calcmacro() in module one to calculate the summary procedure.

  6. #6
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: VBA sub procedure

    you want something more like this?

    Sub calcmacro2()
    For i = 3 To 12
    Sheets("CalcDummy").Range("B5").Value = Sheets("summary table").Range("B" & i).Value
    Sheets("CalcDummy").Range("B6").Value = Sheets("summary table").Range("C" & i).Value
    Sheets("CalcDummy").Range("B7").Value = Sheets("summary table").Range("D" & i).Value
    Call CalcMacro
    Sheets("summary table").Range("e" & i & ":x" & i).Value = Application.Transpose(Sheets("CalcDummy").Range("c11:C30"))
    Next i
    End Sub

+ 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. Excel VBA or any free tool for list all VBA function procedure and Sub Procedure
    By bennyys in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2017, 02:03 AM
  2. [SOLVED] call variable from one procedure to in other procedure
    By shiva_raj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2017, 02:19 AM
  3. [SOLVED] Exit Sub Procedure when called on Sub Procedure Exits
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2015, 08:17 AM
  4. Calling Procedure or Function inside another Procedure - variables problem
    By Rudo123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2015, 03:12 PM
  5. Procedure skips portion of code when called from another procedure
    By abkar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-26-2014, 05:14 PM
  6. [SOLVED] How to use second procedure (the 2nd Sub) results in first procedure in the same module
    By lubbamkt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2014, 10:17 AM
  7. [SOLVED] Create a time delay at end of procedure that will then call on next procedure
    By Clay Shooter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2013, 05:56 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