+ Reply to Thread
Results 1 to 6 of 6

Macro will not paste data in range

Hybrid View

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    INDIA
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    19

    Macro will not paste data in range

    Please help me !


    I have one problem in excel sheet.EXCELFORM.xlsm
    Which i attach with this post.


    My range of souce data change every time
    that is my problem to run macro in this.
    Last edited by REHANSRSPL; 03-11-2013 at 03:29 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Macro will not paste data in range

    Hi, REHANSRSPL,

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
        Range("E4").FormulaR1C1 = "SS"
        Range("E5").FormulaR1C1 = "=+RC[-2]-RC[-1]"
        Range("E5").AutoFill Destination:=Range("E5:E" & Cells(Rows.Count, "D").End(xlUp).Row)
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    INDIA
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    19

    Re: Macro will not paste data in range

    Thanks a lot !

  4. #4
    Registered User
    Join Date
    02-20-2013
    Location
    INDIA
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    19

    Re: Macro will not paste data in range

    One more thing dear if i want to use +concatenate(c1+d1) or other formula

    then what i do this please expl
    i am new in vb editing
    Last edited by REHANSRSPL; 03-11-2013 at 03:28 AM.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Macro will not paste data in range

    Hi, REHANSRSPL,

    concatenate won´t work with a + in between as it expects the ranges which should be pout together in a cell like (in R1C1)
    =CONCATENATE(RC[-2],RC[-1])
    R1C1 depends an the active cell row and column , here it shows that the R is the same as the cell the formula is put in while C indicates 2 columns to left resp. 1 to the left of the original cell. Writing it in A1-Notification the formula should look like
    =CONCATENATE(C6841,D6841)
    The first formula could be placed into the code without problem as VBA expects the formula to be i R1C1-Notifcation:
    Range("E5").FormulaR1C1 = "=CONCATENATE(RC[-2],RC[-1])"
    Best way maybe to find out about a formula to use in VBA is to type it into the cell, let that cell be the active one, change into the VBE and type into the Immediate Window(CTRL+G):
    ?ActiveCell.FormulaR1C1
    and hit Enter.

    Please note that Excel doesn´t need an + or - to start a function which you can start either using the Function Wizard or by typing = into the cell directly.

    HTH,
    Holger

  6. #6
    Registered User
    Join Date
    02-20-2013
    Location
    INDIA
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    19

    Re: Macro will not paste data in range

    Thanks
    for your help!

+ 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