+ Reply to Thread
Results 1 to 9 of 9

Macro to F2-F9 a selection of cells

  1. #1
    Registered User
    Join Date
    12-30-2014
    Location
    Columbus, OH
    MS-Off Ver
    Office 2010
    Posts
    44

    Macro to F2-F9 a selection of cells

    Good morning,
    I'm trying to program a macro that: 1) extracts a specific sheet from an indexed workbook; 2) converts all of the formula-derived cells into their absolute values; 3) opens up a save-as prompt.

    My workbook has index formula to auto-populate multiple spreadsheets. When I try to extract one of the workbooks to save separately (to send out-of-company), the problem is that the index-derived cells stay linked to the original document. I can manually select every formula-derived cell, hit F2 to edit, then F9 to calculate and replace the formula with the value, but that's time consuming. Can I program a macro to do all of that? I tried, but I failed.

    The worksheet I'd like to extract is named 'Silliker SARF', or 'FSNS SARF' (two separate workbooks that use the same system and I'll be adding this macro to both).
    Cells to convert from formula to value:
    F19, I24, J24, K24, L24, B33, D33, I33, J33, K33, L33, I34, J34, K34, L34 and maybe adding more later...which I can do once I see the coding pattern.

    Any thoughts?
    Thanks to one and all!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Macro to F2-F9 a selection of cells

    You could use code to do a copy then paste special values.
    Please Login or Register  to view this content.
    Or just this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-30-2014
    Location
    Columbus, OH
    MS-Off Ver
    Office 2010
    Posts
    44

    Re: Macro to F2-F9 a selection of cells

    Do I put this in the Alt-F11 VBA prompt, or do I program a macro with
    Range("F19").Copy
    Range("F19").PasteSpecial xlPasteValues

    Again, the most important part of this process is to isolate that single spreadsheet into a new file, which I've done with Macro...but I can't figure out the coversion of Formula to value for all cells inside that Macro.
    Thank you.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to F2-F9 a selection of cells

    Does this help?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-30-2014
    Location
    Columbus, OH
    MS-Off Ver
    Office 2010
    Posts
    44

    Re: Macro to F2-F9 a selection of cells

    John Davis, I'm sorry, but I'm not sure what to do with that. Where do I insert that code? Into the VBA under the "ThisWorkbook" heading? If yes, how do I execute this? I don't want it running by itself. I'd like this procedure to only run on the copied file.

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Macro to F2-F9 a selection of cells

    I tend to use something along the lines of the code below.

    Change Sheet1 to the sheet name you wish to copy to a new workbook.

    Put this code in a regular module and execute it via a button.

    Please Login or Register  to view this content.
    Does that do what you need?

    BSB.
    Last edited by BadlySpelledBuoy; 02-19-2015 at 09:37 AM.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to F2-F9 a selection of cells

    No goes in a Standard Module. If you do not have one, then in the VBE toolbars>Insert>Module. Paste the code there.

  8. #8
    Registered User
    Join Date
    12-30-2014
    Location
    Columbus, OH
    MS-Off Ver
    Office 2010
    Posts
    44

    Re: Macro to F2-F9 a selection of cells

    Thanks BSB and John H Davis. This is working. Odd 'glitch', when the Save-As prompt opens, I type in a name and click save, but it doesn't save. I have to go back in and click save-as manually. Not the end of the world...I'm sure my co-worker can figure that out!
    Thanks a ton, everyone!

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Macro to F2-F9 a selection of cells

    Amended the code above to deal with the SaveAs properly.

    Hope that helps.

    BSB

+ 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. need help with macro for cut/paste a selection of cells
    By chotapapa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2014, 04:49 PM
  2. Running 1 macro on a selection of cells
    By rjm12 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-01-2011, 07:26 AM
  3. Macro to address cells in the next column to selection
    By miles_muso in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2008, 07:34 AM
  4. [SOLVED] Macro to select cells and then new selection from selected cells
    By Rewop Eilsel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2006, 11:25 AM
  5. How do I print a selection of cells using a macro?
    By gussuffert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2005, 05:06 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