excel vba - Cell Selection Methods R1C1 or? -


i stumbled on accidently , haven't been able find answer online. these 2 similar looking lines of code give different results. i'm ok r1c1 version. can me understand , name other? many time, paul

sub testcells()  cells(1, 2).select cells(1)(2).select  end sub 

just cells(1, 2) shorthand for: cells.item(1, 2)

so cells(1)(2) shorthand for:

cells.item(1).item(2)

cells.item(1) returns range a1, , second item property relative a1 a2. same using: range("a1").range("a2")

a couple of things note:

  1. the start cell doesn't have a1 - example, cells(2)(3) refers b3 (the first step gets b1, 3 takes b3)
  2. if specify 1 number item property, result depends on width of original range count goes left right , top bottom.

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -