Extended sheet selection in Excel 2013 - VBA -


could please understand why code works in older versions of excel not in excel 2013? line replace:=false ignored. related central settings? should modified?

sub test()     dim     dim n      n = inputbox("type n")      = 1 n         if = 1 thisworkbook.sheets(i).select         if > 1 thisworkbook.sheets(i).select replace:=false     next end sub 

i tried code in excel 2013. possible reasons thisworkbook not active workbook or sheets invisible. should use select function on active workbook. see below code updated - used in workbook hidden sheets , worked. @ immediate window in vba editor (ctrl+g) see debug messages. note hidden sheets count variable 'n'. hope helps.

sub test()     dim     dim n     dim foundfirstvissheet boolean     foundfirstvissheet = false      n = inputbox("type n")     dim mysh worksheet       = 1 n          set mysh = activeworkbook.sheets(i)         if mysh.visible = xlsheetvisible             if not foundfirstvissheet                 foundfirstvissheet = true                 mysh.activate             end if             debug.print mysh.name & " visible"             mysh.select replace:=false         else             debug.print mysh.name & " invisible , cannot selected"         end if      next end sub 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -