+ Reply to Thread
Results 1 to 2 of 2

Auto adjusting macros to new workmap name.

  1. #1
    Registered User
    Join Date
    11-03-2020
    Location
    Ranst, Belgium
    MS-Off Ver
    365
    Posts
    4

    Auto adjusting macros to new workmap name.

    Hi
    Im currently working with a macro that switches between workbooks. The name of the original worbook is in the code. Is there a possibility to auto adjust this name in the code when i save this workbook under a different name?
    the problem is in the last line of the example below. Maybe i need a different aproach to this situation?

    Sheets("kostblad").Select
    Range("A8:K8").Select
    Selection.Copy
    Workbooks.Open Filename:="C:\Users\Yannick\Desktop\Planning Blanco.xlsx"
    Sheets("voorbereiden").Select
    Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValues
    [a1].Select
    Workbooks("CAD-CAM X-- 3 lagen blanco NIEUW.xlsm").Activate

    Thanks in advance for any help.

  2. #2
    Registered User
    Join Date
    11-03-2020
    Location
    Ranst, Belgium
    MS-Off Ver
    365
    Posts
    4

    Re: Auto adjusting macros to new workmap name.

    I think I found a way, not sure if this is the best solution..
    Dim workbookname As Variant
    workbookname = ActiveWorkbook.Name
    Sheets("kostblad").Select
    Range("A8:K8").Select
    Selection.Copy
    Workbooks.Open Filename:="C:\Users\Yannick\Desktop\Planning Blanco.xlsx"
    Sheets("voorbereiden").Select
    Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValues
    [a1].Select
    Workbooks(workbookname).Activate

    any advice is still welcome

+ 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. [SOLVED] vba macros to apply formula for dynamic Auto Adjusting range references
    By Abdur_rahman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-23-2019, 09:25 AM
  2. Auto Adjusting Sum
    By matt85webb in forum Excel General
    Replies: 4
    Last Post: 10-20-2015, 02:15 PM
  3. Teared up workmap
    By Dragoness in forum Excel General
    Replies: 1
    Last Post: 06-18-2014, 02:43 PM
  4. Replies: 12
    Last Post: 03-17-2014, 06:55 PM
  5. Need help adjusting this Formatting Macros
    By copleyr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2009, 10:27 AM
  6. Row Height auto-adjusting?
    By pgleek in forum Excel General
    Replies: 1
    Last Post: 08-23-2007, 04:42 PM
  7. Auto Adjusting Text Box
    By Jae in forum Excel General
    Replies: 0
    Last Post: 08-11-2005, 02: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