+ Reply to Thread
Results 1 to 3 of 3

Run-time error '6'

  1. #1
    Registered User
    Join Date
    08-15-2015
    Location
    Russi
    MS-Off Ver
    2010
    Posts
    3

    Question Run-time error '6'

    Hi guys, I have query which calculates and autofills columns, but there's a problem "run-time error 6" on 3rd row.
    ________________
    Sub Macros()
    Dim lastOne As Integer
    lastOne = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
    Range("H1").Value = "Cost1"
    Range("I1").Value = "Cost2"
    Range("J1").Value = "Cost3"
    Range("K1").Value = "Value"
    Range("K1").Select
    With Selection.Font
    .Color = -16776961
    .TintAndShade = 0
    End With
    Range("H2").Select
    ActiveCell.FormulaR1C1 = "=R[+1]C[-3]+RC[-3]"
    Range("I2").Select
    ActiveCell.FormulaR1C1 = "=R[+1]C[-3]+RC[-3]"
    Range("J2").Select
    ActiveCell.FormulaR1C1 = "=R[+1]C[-3]+RC[-3]"
    Range("K3").Select
    ActiveCell.FormulaR1C1 = "=RC[-1]-R[-1]C[-1]"
    Range("H2:K2").AutoFill Destination:=Range("H2:K2" & CStr(lastOne)), Type:=xlFillDefault
    End Sub
    _____________________________________

    When I'm trying to change 'integer' to 'long' there's another problem "Run-time error 1004, Method 'Range' of object '_Global' Failed" on 21st row.

    I would be appreciative for any advice.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run-time error '6'

    Try this and report back

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Run-time error '6'

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

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/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)

+ 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. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  2. Loop Nesting is returning Run-Time Error '-2147221080 (800401a8)': Automation Error
    By ChristopherBrandonKi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 02:36 PM
  3. [SOLVED] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  4. Cannot Publish Excel Pivot Chart - Run Time Error
    By crisb184 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2013, 07:04 AM
  5. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  6. run-time error ;2147023179 (800706b5) time automation error interface unknown
    By karthik72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2012, 09:31 AM
  7. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM

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