vba - What do I set "Dim y As"? -


so i'm trying order list 1 through whatever bottom # is. within doing i'm in way moving of information right. i'm going bottom of selection find bottom of list in column b. , left 1, find bottom column fill in # system way down bottom of list.

private sub commandbutton2_click()        'my problem don't know set "dim y range" know range         'incorrect along long, , integer.     dim y range     sheets("palmfamily").select     columns("a:a").select     selection.insert shift:=xltoright, copyorigin:=xlformatfromleftorabove     range("a1").select     activecell.formular1c1 = "1"     range("a2").select     activecell.formular1c1 = "2"     range("a3").select     activecell.formular1c1 = "3"     range("a1:a3").select        'as can notice have weird code         '" y = range("b1").end(xldown).offset(0, -1)" i'm trying go bottom         'of list move left 1.      y = range("b1").end(xldown).offset(0, -1)        'as i'm not sure if set range correct when        '"range("a1,y")"     selection.autofill destination:=range("a1,y"), type:=xlfilldefault     range("a1,y").select end sub 

the code posted not compile, can tell looking @ it.

you have declared y range object, requires set keyword when assigning.

set y = range("b1").end(xldown).offset(0, -1)

furthermore, range("a1,y") syntax error see in 2 places. both of these, think, should changed :

range("a1", y)

note comma , "y" not enclosed in quote marks.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -