+ Reply to Thread
Results 1 to 8 of 8

How can I update my marco to export my output to a new workbook with hard coded values

  1. #1
    Registered User
    Join Date
    02-07-2017
    Location
    Chicago
    MS-Off Ver
    Office 2010 and 2016
    Posts
    8

    How can I update my marco to export my output to a new workbook with hard coded values

    I am trying to get my macro I have been working on with some peoples help here to export the templates i am exporting to a new workbook, how would I go about modifying the code to do this? I have attached the workbook and the code below

    Sub AddTemplateSheet()
    Dim myCell As Range, myRange As Range

    Set myRange = Sheets("Input").Range("F8")
    Set myRange = Range(myRange, myRange.End(xlDown))

    For Each myCell In myRange
    If myCell <> "" Then
    If Not Evaluate("=ISREF('" & myCell.Value & "'!A1)") Then
    Sheets("Template").Copy After:=Sheets(Sheets.Count)
    Sheets(Sheets.Count).Name = myCell.Value
    End If
    End If
    Next myCell
    End Sub


    https://www.dropbox.com/s/1y311hbbg2...orum.xlsm?dl=0

    Thanks for your help!

  2. #2
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    Try this


    Please Login or Register  to view this content.
    [/CODE]
    Teach me Excel VBA

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    I have looked at your file and am reading what you ask but I honestly do not understand what you want to do.
    You select all the cells in column F form row 8 to 111
    Then you query each cell in that column and if it references correctly yo add a new worksheet at the end with the value in that cell.
    What are you exporting to a new workbook?
    If you could please explain it i a way that we can understand you we will be able to help you.
    I am sure that for a person who knows what he is doing it is quite clear but you need to explain it to someone that has absolutely no idea (yet) of what you really require.
    The cells in the Input worksheet in column F8-F111 return empty values so I cannot even test it
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  4. #4
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    Maybe...

    Please Login or Register  to view this content.
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  5. #5
    Registered User
    Join Date
    02-07-2017
    Location
    Chicago
    MS-Off Ver
    Office 2010 and 2016
    Posts
    8

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    So the need has slightly changed, in the template sheet I have a bunch of formulas that pull data from a hyperion server and I have to update all of the pages before I can export to a new workbook. The new workbook would also need the numbers to be pasted as values.

    So I am guessing I would change the above formula to Sheets("Template").copyafter and then I am not sure how you would go about pasting these sheets as values.
    Last edited by roledzki; 02-13-2017 at 03:10 PM.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    Since I have absolutely no idea what the import looks like and how the 'final "Template" sheet will be filled I cannot help you.

    If you want to save a worksheet as a new workbook

    Please Login or Register  to view this content.
    You can always select all cells and paste them again as only values to get rid of the formulas

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-07-2017
    Location
    Chicago
    MS-Off Ver
    Office 2010 and 2016
    Posts
    8

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    Hi Keebellah,

    Let me explain what I am doing in this workbook to see if it helps you. This is just an example with any confidential data removed. For the actual worksheet the template is a financial data template that has formulas to pull data from a hyperion server. In the input sheet you have a drop down list of departments and when you select one department a list of all the sub departments is produced. When you run the macro it produces a sheet for every sub department with the sub department number in that sheet. These sheets then pull the hyperion data for that sub department. The last step i am trying to figure out is a second macro that will export the new created sheets into a new workbook as values. I hope this clears things up, let me know if you need more detail.

    Thanks,
    Rob

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: How can I update my marco to export my output to a new workbook with hard coded values

    Hi Rob,
    I don't see a link to any file but anyway your explanation tells me more now.
    One you have the sheet you want you can use the macro I showed to save it as new workbook.
    It copies it and saves it as new workbook.
    Instead of the "Template" you pass it the name of the new wroksheet.
    Create a Sub with a aprameter to do so

    e.g

    Please Login or Register  to view this content.
    Something like this, you will have to check Syntax and so since I just copied and typed, not tested for errors.

+ 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. hard-coded vs ?
    By daulpuchich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2015, 10:19 AM
  2. Replies: 5
    Last Post: 08-21-2014, 09:10 AM
  3. Excel 2007 : Use a variable instead of a hard coded value
    By ThomasHaller in forum Excel General
    Replies: 2
    Last Post: 12-15-2011, 01:45 PM
  4. Drop Down List Hard Coded Values
    By swalsh84 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2009, 03:19 AM
  5. Convert Hard-coded cell values to constants
    By Takeadoe in forum Excel General
    Replies: 2
    Last Post: 05-19-2006, 08:10 PM
  6. [SOLVED] Convert Hard-coded cell values to constants
    By Takeadoe in forum Excel General
    Replies: 2
    Last Post: 05-19-2006, 11:45 AM
  7. hard coded text
    By William Benson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2005, 02:05 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