+ Reply to Thread
Results 1 to 2 of 2

Help with a Type Error

  1. #1
    Registered User
    Join Date
    10-19-2005
    Posts
    45

    Question Help with a Type Error

    I am trying to use the following Macro to copydown the Formula = C1 & E1 But I am getting a type error.

    Public Sub CopyDown1()


    Range("A1").Select
    lastRow = Range("A65536").End(xlUp).Row
    For i = 1 To lastRow
    If Range("A" & i).Value = "" Then
    Range("A" & i - 1 & ":A" & i - 1).Copy Destination:=Range("A" & i)
    End If
    Next i

    End Sub

    What am I doing wrong?

    The error is: Range("A" & i).Value = Error 2015

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    you could try pasting this in to a standard module, you would need a button on your toolbar to run the macro or a keyboard shortcut, you can enter your range in the first input box and then your formula or anything you want in the cells in the second.

    Have fun!

    Regards,
    Simon

    Sub cpystuff()
    Dim rng As Range
    Dim mycell
    Dim t
    t = InputBox("Enter your range in this format A1:A20", "Range entry", "You must not use the inverted commas before and after the range")
    s = InputBox("enter your formula here!")
    Set rng = Range(t)
    With Sheets(ActiveSheet.Name)
    For Each mycell In rng
    mycell.Value = s
    Next mycell
    End With
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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