+ Reply to Thread
Results 1 to 2 of 2

How to run the macro for specific times?

Hybrid View

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    1

    How to run the macro for specific times?

    Dear all,

    1) the code is starting from Range("A1").
    i want it should run it on any cell of the sheet.

    2) the value is also set for sr. no 1 to 20.
    i want it should ask me like "how many items in table?"

    3) the same code runs only one time in sheet.
    i want it should runs for n times, means it should ask me like "how many tables?"

    thanks in advance.

    following is the code:

    Sub Evaluation()
    '
    Range("A3").FormulaR1C1 = "Sr"
    Range("A4").FormulaR1C1 = "No"
    Range("A5").FormulaR1C1 = "1"
    Range("A6").FormulaR1C1 = "2"
    Range("A7").FormulaR1C1 = "3"
    Range("A8").FormulaR1C1 = "4"
    Range("A9").FormulaR1C1 = "5"
    Range("A10").FormulaR1C1 = "6"
    Range("A11").FormulaR1C1 = "7"
    Range("A12").FormulaR1C1 = "8"
    Range("A13").FormulaR1C1 = "9"
    Range("A14").FormulaR1C1 = "10"
    Range("A15").FormulaR1C1 = "11"
    Range("A16").FormulaR1C1 = "12"
    Range("A17").FormulaR1C1 = "13"
    Range("A18").FormulaR1C1 = "14"
    Range("A19").FormulaR1C1 = "15"
    Range("A20").FormulaR1C1 = "16"
    Range("A21").FormulaR1C1 = "17"
    Range("A22").FormulaR1C1 = "18"
    Range("A23").FormulaR1C1 = "19"
    Range("A24").FormulaR1C1 = "20"
    Range("B1").FormulaR1C1 = "Value1 "
    Range("B3").FormulaR1C1 = "Name"
    Range("B28").FormulaR1C1 = "Value3"
    Range("C28").FormulaR1C1 = "=IF(ISERROR(R[-3]C/RC[8]*100),"""",R[-3]C/RC[8]*100)"
    Range("D5:D24").FormulaR1C1 = "=IF(ISERROR(RC[-1]/RC[1]),"""",RC[-1]/RC[1])"
    Range("D28").FormulaR1C1 = "Value8"
    Range("E4").FormulaR1C1 = "Value9"
    Range("G4").FormulaR1C1 = "Value13"
    Range("G5:G24").FormulaR1C1 = "=IF(ISERROR(RC[-2]*RC[1]),"""",RC[-2]*RC[1])"
    Range("H4").FormulaR1C1 = "Value14"
    Range("H5:H24").FormulaR1C1 = _
    "=IF(ISERROR(RC[-2]*RC[-4]/100),"""",RC[-2]*RC[-4]/100)"
    Range("I3").FormulaR1C1 = "Value15"
    Range("I4").FormulaR1C1 = "Value16"
    Range("I5:I24").FormulaR1C1 = "=IF(ISERROR(RC[-6]-RC[-2]),"""",RC[-6]-RC[-2])"
    Range("I28").FormulaR1C1 = "Value17"
    Range("J4").FormulaR1C1 = "Value18"
    Range("J5:J24").FormulaR1C1 = "=IF(ISERROR(RC[-6]-RC[-2]),"""",RC[-6]-RC[-2])"
    Range("K3").FormulaR1C1 = "Value19"
    Range("K4").FormulaR1C1 = "Value20"
    Range("K5").FormulaR1C1 = _
    "=IF(ISERROR(RC[-8]/R[20]C[-8]),"""",RC[-8]/R[20]C[-8])"
    Range("K6").FormulaR1C1 = _
    "=IF(ISERROR(R[-1]C*RC[-2]/R[-1]C[-8]),"""",R[-1]C*RC[-2]/R[-1]C[-8])"
    Range("K7").FormulaR1C1 = _
    "=IF(ISERROR(R[-2]C*RC[-2]/R[-2]C[-8]),"""",R[-2]C*RC[-2]/R[-2]C[-8])"
    Range("K8").FormulaR1C1 = _
    "=IF(ISERROR(R[-3]C*RC[-2]/R[-3]C[-8]),"""",R[-3]C*RC[-2]/R[-3]C[-8])"
    Range("K9").FormulaR1C1 = _
    "=IF(ISERROR(R[-4]C*RC[-2]/R[-4]C[-8]),"""",R[-4]C*RC[-2]/R[-4]C[-8])"
    Range("K10").FormulaR1C1 = _
    "=IF(ISERROR(R[-5]C*RC[-2]/R[-5]C[-8]),"""",R[-5]C*RC[-2]/R[-5]C[-8])"
    Range("K11").FormulaR1C1 = _
    "=IF(ISERROR(R[-6]C*RC[-2]/R[-6]C[-8]),"""",R[-6]C*RC[-2]/R[-6]C[-8])"
    Range("K12").FormulaR1C1 = _
    "=IF(ISERROR(R[-7]C*RC[-2]/R[-7]C[-8]),"""",R[-7]C*RC[-2]/R[-7]C[-8])"
    Range("K13").FormulaR1C1 = _
    "=IF(ISERROR(R[-8]C*RC[-2]/R[-8]C[-8]),"""",R[-8]C*RC[-2]/R[-8]C[-8])"
    Range("K14").FormulaR1C1 = _
    "=IF(ISERROR(R[-9]C*RC[-2]/R[-9]C[-8]),"""",R[-9]C*RC[-2]/R[-9]C[-8])"
    Range("K15").FormulaR1C1 = _
    "=IF(ISERROR(R[-10]C*RC[-2]/R[-10]C[-8]),"""",R[-10]C*RC[-2]/R[-10]C[-8])"
    Range("K16").FormulaR1C1 = _
    "=IF(ISERROR(R[-11]C*RC[-2]/R[-11]C[-8]),"""",R[-11]C*RC[-2]/R[-11]C[-8])"
    Range("K17").FormulaR1C1 = _
    "=IF(ISERROR(R[-12]C*RC[-2]/R[-12]C[-8]),"""",R[-12]C*RC[-2]/R[-12]C[-8])"
    Range("K18").FormulaR1C1 = _
    "=IF(ISERROR(R[-13]C*RC[-2]/R[-13]C[-8]),"""",R[-13]C*RC[-2]/R[-13]C[-8])"
    Range("K19").FormulaR1C1 = _
    "=IF(ISERROR(R[-14]C*RC[-2]/R[-14]C[-8]),"""",R[-14]C*RC[-2]/R[-14]C[-8])"
    Range("K20").FormulaR1C1 = _
    "=IF(ISERROR(R[-15]C*RC[-2]/R[-15]C[-8]),"""",R[-15]C*RC[-2]/R[-15]C[-8])"
    Range("K21").FormulaR1C1 = _
    "=IF(ISERROR(R[-16]C*RC[-2]/R[-16]C[-8]),"""",R[-16]C*RC[-2]/R[-16]C[-8])"
    Range("K22").FormulaR1C1 = _
    "=IF(ISERROR(R[-17]C*RC[-2]/R[-17]C[-8]),"""",R[-17]C*RC[-2]/R[-17]C[-8])"
    Range("K23").FormulaR1C1 = _
    "=IF(ISERROR(R[-18]C*RC[-2]/R[-18]C[-8]),"""",R[-18]C*RC[-2]/R[-18]C[-8])"
    Range("K24").FormulaR1C1 = _
    "=IF(ISERROR(R[-19]C*RC[-2]/R[-19]C[-8]),"""",R[-19]C*RC[-2]/R[-19]C[-8])"
    Range("K25").FormulaR1C1 = _
    "=IF(ISERROR(RC[-8]*R[-20]C/R[-20]C[-8]),"""",RC[-8]*R[-20]C/R[-20]C[-8])"
    Range("K28").FormulaR1C1 = _
    "=IF(ISERROR(RC[-3]*R[-23]C[-8]/RC[-6]),"""",RC[-3]*R[-23]C[-8]/RC[-6])"
    Range("L3").FormulaR1C1 = "Value21"
    Range("L4").FormulaR1C1 = "Value28"
    Range("L5").FormulaR1C1 = "=IF(ISERROR(RC[-1]/RC[-1]),"""",RC[-1]/RC[-1])"
    Range("L6").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-1]C[-1]),"""",RC[-1]/R[-1]C[-1])"
    Range("L7").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-2]C[-1]),"""",RC[-1]/R[-2]C[-1])"
    Range("L8").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-3]C[-1]),"""",RC[-1]/R[-3]C[-1])"
    Range("L9").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-4]C[-1]),"""",RC[-1]/R[-4]C[-1])"
    Range("L10").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-5]C[-1]),"""",RC[-1]/R[-5]C[-1])"
    Range("L11").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-6]C[-1]),"""",RC[-1]/R[-6]C[-1])"
    Range("L12").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-7]C[-1]),"""",RC[-1]/R[-7]C[-1])"
    Range("L13").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-8]C[-1]),"""",RC[-1]/R[-8]C[-1])"
    Range("L14").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-9]C[-1]),"""",RC[-1]/R[-9]C[-1])"
    Range("L15").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-10]C[-1]),"""",RC[-1]/R[-10]C[-1])"
    Range("L16").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-11]C[-1]),"""",RC[-1]/R[-11]C[-1])"
    Range("L17").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-12]C[-1]),"""",RC[-1]/R[-12]C[-1])"
    Range("L18").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-13]C[-1]),"""",RC[-1]/R[-13]C[-1])"
    Range("L19").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-14]C[-1]),"""",RC[-1]/R[-14]C[-1])"
    Range("L20").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-15]C[-1]),"""",RC[-1]/R[-15]C[-1])"
    Range("L21").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-16]C[-1]),"""",RC[-1]/R[-16]C[-1])"
    Range("L22").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-17]C[-1]),"""",RC[-1]/R[-17]C[-1])"
    Range("L23").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-18]C[-1]),"""",RC[-1]/R[-18]C[-1])"
    Range("L24").FormulaR1C1 = _
    "=IF(ISERROR(RC[-1]/R[-19]C[-1]),"""",RC[-1]/R[-19]C[-1])"
    Range("M3").FormulaR1C1 = "Value22"
    Range("N4").FormulaR1C1 = "Value27"
    Range("N5:N24").FormulaR1C1 = "=IF(ISERROR(RC[-1]*RC[-3]),"""",RC[-1]*RC[-3])"
    Range("N25").FormulaR1C1 = _
    "=IF(ISERROR(SUM(R[-20]C:R[-1]C)),"""",SUM(R[-20]C:R[-1]C))"
    Range("N28").FormulaR1C1 = _
    "=IF(ISERROR(R[-3]C[-11]/R[-23]C[-11]),"""",R[-3]C[-11]/R[-23]C[-11])"
    End Sub

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: How to run the macro for specific times?

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

+ 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] Running macro specific # of times
    By The Skipper in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-05-2012, 10:47 AM
  2. [SOLVED] Macro to copy a row # times onto a specific tab?
    By KPBailey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2012, 09:10 AM
  3. Macro Loop – Find Specific Times, Extract Date, Average Values of Times
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-25-2010, 02:50 PM
  4. Run macro on specific times automatically
    By nicolasphilipp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2009, 08:23 AM
  5. [SOLVED] How do I set a macro to run at specific times?
    By Nick123 in forum Excel General
    Replies: 1
    Last Post: 07-26-2005, 02:05 PM

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