Results 1 to 2 of 2

Run several sheet specific VBA Codes from a single Macro

Threaded View

  1. #1
    Registered User
    Join Date
    06-29-2013
    Location
    Sweden, Gothenburg
    MS-Off Ver
    Excel 2010
    Posts
    1

    Run several sheet specific VBA Codes from a single Macro

    Hi.
    I am a beginner when it comes to VBA. I have tried to find the answer to my problem on several forumtreads, but it seems like I don't really understand the advance solutions.
    My macro simply copies values from a Yahoo finance table in Sheet1, to Sheet2, post date and make another row.
    What I want to do is someting like this, but correctly written.

    Sub RunAll()
    Call btnRefresh_Click
    Call Sheet(2).test1     'Run-time error '438: Object doesn't support this property
    Call Sheet(3).test2
    End Sub
    Below is a small sample of my macro.

    Private Sub test1()
    i = 2 'Row
    j = 2 'column for numbers
    Cells(i, j) = Sheets(1).Cells(2, 6) 
    Cells(i, j).NumberFormat = "0.00%" 'Format to %
    i = 2 'Row
    For j = 2 To 9 'column for numbers
    Cells(i, j) = Sheets(1).Cells(6, 6) - Sheets(1).Cells(j, 6) 'Copy value from Sheet(1).Cells(6,6) minus Sheet(1).Cells(2,2:9)
    Cells(i, j).NumberFormat = "0.00%" ' format to %
    Next j
    i = 2 'Row
    j = 1 'column for numbers
    Cells(i, j) = Date 'Insert todays date in cell (2,1)
    Cells(2, 2).EntireRow.Insert
    End Sub
    I hope it wont be to much problems for you guys, but I have been trying to fix this for two days now and aint coming nowhere.
    Please be very simple in your explanations, else I won't understand
    Last edited by hangmattan; 06-29-2013 at 07:16 AM.

Thread Information

Users Browsing this Thread

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

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