+ Reply to Thread
Results 1 to 3 of 3

Help with writing code from record macro

Hybrid View

  1. #1
    Registered User
    Join Date
    09-18-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Help with writing code from record macro

    I used the record macro tool to get an idea of what I want to do in code. I am having trouble modifying it though to suit my needs when the selection of cells for the array changes.

    Range("D1:D23").Select
        Selection.FormulaArray = _
            "=RC[-3]:R[22]C[-3]+'[South DDACTS Zone Tally_R20130910.xlsx]APlt'!R149C9:R171C9"
    In the above, I selected a range of cells D1:D23 where I will be outputting my final array into. I typed '=' into the function bar and then selected a set of cells (on a worksheet "sheet3") which were A1:23. I typed '+' into the function bar and then selected a second set of cells on a separate workbook which were I149:I171. I pressed CTRL+SHIFT+ENTER to make the function bar my formula and it spit out the new values into D1:D23.

    The function bar looks like this:

    =A1:A23+'[South DDACTS Zone Tally_R20130910.xlsx]APlt'!$I$149:$I$171

    This macro would be great if I did not need to have the ability to change the second set of cells that I added to the first.

    In the macro I am working on, I take a value from a sheet in one workbook and search a second workbook for that value. When that value is found, I need to select a range of cells (always 23 cells) in the column that I found my vaule in that starts two rows below the cell where I found the value (call this arrayA). I need to take arrayA and add it to A1:A23, or arrayB, (which is a fixed location from the other spreadsheet). That new array needs to be written over the place of arrayA.

    Any help is appreciated.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Help with writing code from record macro

    Hello brett131,

    Welcome to the Forum!

    Are looking for a formula solution or VBA macro?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-18-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Help with writing code from record macro

    VBA Macro.

+ 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. Macro code .. to find and paste or writing a formula.
    By ajkh89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 12:51 PM
  2. Error when Writing code by macro
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2012, 08:03 AM
  3. Writing Complex Macro or VBA Code?
    By Sohail iqbal in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-16-2006, 11:50 AM
  4. [SOLVED] vba code to record a macro
    By green fox in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2006, 05:50 PM
  5. code:writing macro
    By EFFY in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2005, 01:05 PM

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