Sunday, 15 May 2011

vba - Macro handling difference between MS Excel 2010 and MS Excel 2013 -



vba - Macro handling difference between MS Excel 2010 and MS Excel 2013 -

i modifying macro made 2005 , running on previous versions of excel. beingness used in ms excel 2010, using ms excel 2013 modify codes. there effects or compatibility issues?

a link explaining handling of macros on different version of excels much appreciated. give thanks you.

here's 1 "gotcha" on look-out for: excel 2007, microsoft introduced "big grid". huge jump in number of available rows , columns, users have potentially started leveraging.

perhaps had forward-thinking grouping writing vba business in 2005, @ old gig next status quo identifying lastly row:

lastrow = range("a65536").end(xlup).row

if 2007, 2010 or 2013 worksheet has more 65,536 populated rows, above not going homecoming expected result, , old script fail, or, worse, homecoming wrong result.

you should sniff out lastly row (or lastly column) identification above , refactor using techniques described @siddharthrout in definitive post on finding lastly row: error finding lastly used cell in vba... in nutshell:

find lastly row in column (below looks lastly occupied row in column on sheet1)

with sheets("sheet1") lastrow = .range("a" & .rows.count).end(xlup).row end

find lastly row in sheet (below uses counta protect against empty sheet1)

with sheets("sheet1") if application.worksheetfunction.counta(.cells) <> 0 lastrow = .cells.find(what:="*", _ after:=.range("a1"), _ lookat:=xlpart, _ lookin:=xlformulas, _ searchorder:=xlbyrows, _ searchdirection:=xlprevious, _ matchcase:=false).row else lastrow = 1 end if end

excel vba excel-vba compatibility

No comments:

Post a Comment