+ Reply to Thread
Results 1 to 4 of 4

Windows 10 issue with Sheet placement

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2019
    Posts
    209

    Windows 10 issue with Sheet placement

    Hi,

    I am currently working on upgrade to Windows 10 and seems to found issue with sheet name needs to be written before range/cells, however it seems to be intermittent.

    For example below code is not working,
    Range("V20").Value = "Sales Forecasting - " & Sheets("directory").Range("B8").Value & " - DESKTOP"
    and have to be change to
    Sheets("Forecast").Range("V20").Value = "Sales Forecasting - " & Sheets("directory").Range("B8").Value & " - DESKTOP"
    However below code without Sheets(...) would work.
        Range("BM26").Formula = "=SUM(BA26:BL26)"
        Range("BN26").Formula = "=BM26/$BM$277"
        Range("BM26:BN26").Copy
        Range("BM26:BN" & eor2).PasteSpecial xlPasteFormulas
        Range("A26:CZ275").Sort Range("BN1"), xlDescending, , , , , , xlNo
        
        Range("V26").Value = 1
        Range("V27").Value = "=V26+1"
        Range("V27").Copy
        Range("V27:V275").PasteSpecial xlPasteFormulas
        Range("V:V").Copy
        Range("V:V").PasteSpecial xlPasteValues
        Application.CutCopyMode = False
        Range("V26").Select
    Can someone point out the changes made to Excel VBA in Windows 10?

    Thanks
    Lex
    Last edited by lexusap; 09-10-2017 at 08:56 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Windows 10 issue with Sheet placement

    What do you mean by "code is not working"?
    Error?

    It depends on which code module the code is written in and what sheet is active for the Range/Cells object without its parent object.

  3. #3
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Windows 10 issue with Sheet placement

    Hi,

    This is not an issue with Windows10....
    If you don't reference the sheet name, the value (or the formula) of the cell will be modified in the ACTIVE sheet when the macro is launched.
    As a good practice, you should ALWAYS refer to the worksheet.. and even the workbook if you are working with multiple workbooks in your macro.

    You could change your code to this :

       
    With Sheets("Forecast")
     .Range("BM26").Formula = "=SUM(BA26:BL26)"
        .Range("BN26").Formula = "=BM26/$BM$277"
        .Range("BM26:BN26").Copy
        .Range("BM26:BN" & eor2).PasteSpecial xlPasteFormulas
        .Range("A26:CZ275").Sort .Range("BN1"), xlDescending, , , , , , xlNo
        
        .Range("V26").Value = 1
        .Range("V27").Value = "=V26+1"
        .Range("V27").Copy
        .Range("V27:V275").PasteSpecial xlPasteFormulas
        .Range("V:V").Copy
        .Range("V:V").PasteSpecial xlPasteValues
        Application.CutCopyMode = False
        .Range("V26").Select
    End With
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  4. #4
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2019
    Posts
    209

    Re: Windows 10 issue with Sheet placement

    Hi,

    Just to clarify, when i said it is not working, it means that the code has been skip (similar to on error resume next). However i do not have on error resume next on the top of the code.
    Just wandering as everything else works find on whoever that have Windows 7 PC and error Windows 10.


    thanks GC Excel for your input. this is gonna be a big task for me as i have been creating more than 20k Lines of coding. it would be a "fun" nightmare to update.

    Thanks
    Lex

+ 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. Replies: 2
    Last Post: 07-08-2015, 08:01 PM
  2. Replies: 2
    Last Post: 11-07-2014, 01:08 PM
  3. Replies: 2
    Last Post: 09-06-2013, 02:17 PM
  4. [SOLVED] Enable / Disable Macros behaving differently in Excel 2003 from Windows XP to Windows 7
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-21-2013, 09:09 AM
  5. Windows 7 :Issue with Exel VBA in Window 7
    By guanqiao in forum Microsoft Windows Help
    Replies: 3
    Last Post: 10-09-2012, 02:31 PM
  6. Replies: 0
    Last Post: 06-10-2010, 01:05 PM
  7. Windows Excel and Macintosh Excel compatebility issue
    By bambino_32 in forum Excel General
    Replies: 3
    Last Post: 12-17-2009, 09:19 AM

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