Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have two three queries?
FIRST If I say Dim rng As range Dim cell As range Set rng = range (A1: C:10) rng.columns(2).select "and then say" For Each cell in rng blah blah My question is does rng now just refer to column 2 or does it refer to the whole range object declared. I'm new to VBA (have done a little JAVA) and the statement rng.columns(2).select on its own seems odd. I would usually expect something more like rng = rng.columns(2).select but does just rng.columns(2).select basically just have that affect until some other function is called on the rng object? SECONDLY I have a variant which may hold a long. I know = cont(integer) will work for an integer, is there an equivalent for a long? THIRDLY If from question one, i have a cell (range object) in the for loop and want to add a comment to the right of that cell by three columns but same row how do i do it. I think i probably need the offset function? Something like For Each cell in rng cell = cell.offset(3,0) cell.addcommment ("comment") next cell MANY MANY THANKS James |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
(1)
If you want to loop through rng then yes what you have suggested as what you are writing will loop through the whole range off the back of rng.columns(2).select if you want to loop through this just write for each cell in selection (3) something like With ActiveCell.AddComment .Visible = True .Text "comments blah blah blah" End With 2 out of 3 aint bad somethinglikeant James Cornthwaite wrote: I have two three queries? FIRST If I say Dim rng As range Dim cell As range Set rng = range (A1: C:10) rng.columns(2).select "and then say" For Each cell in rng blah blah My question is does rng now just refer to column 2 or does it refer to the whole range object declared. I'm new to VBA (have done a little JAVA) and the statement rng.columns(2).select on its own seems odd. I would usually expect something more like rng = rng.columns(2).select but does just rng.columns(2).select basically just have that affect until some other function is called on the rng object? SECONDLY I have a variant which may hold a long. I know = cont(integer) will work for an integer, is there an equivalent for a long? THIRDLY If from question one, i have a cell (range object) in the for loop and want to add a comment to the right of that cell by three columns but same row how do i do it. I think i probably need the offset function? Something like For Each cell in rng cell = cell.offset(3,0) cell.addcommment ("comment") next cell MANY MANY THANKS James |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry should have been activecell.offset(0,3).addcomment
somethinglikeant wrote: (1) If you want to loop through rng then yes what you have suggested as what you are writing will loop through the whole range off the back of rng.columns(2).select if you want to loop through this just write for each cell in selection (3) something like With ActiveCell.AddComment .Visible = True .Text "comments blah blah blah" End With 2 out of 3 aint bad somethinglikeant James Cornthwaite wrote: I have two three queries? FIRST If I say Dim rng As range Dim cell As range Set rng = range (A1: C:10) rng.columns(2).select "and then say" For Each cell in rng blah blah My question is does rng now just refer to column 2 or does it refer to the whole range object declared. I'm new to VBA (have done a little JAVA) and the statement rng.columns(2).select on its own seems odd. I would usually expect something more like rng = rng.columns(2).select but does just rng.columns(2).select basically just have that affect until some other function is called on the rng object? SECONDLY I have a variant which may hold a long. I know = cont(integer) will work for an integer, is there an equivalent for a long? THIRDLY If from question one, i have a cell (range object) in the for loop and want to add a comment to the right of that cell by three columns but same row how do i do it. I think i probably need the offset function? Something like For Each cell in rng cell = cell.offset(3,0) cell.addcommment ("comment") next cell MANY MANY THANKS James |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ah so when i say
rng.columns(2).select this is implying (without explicitly stating) selection = rng.columns(2).select Thanks James "somethinglikeant" wrote in message oups.com... sorry should have been activecell.offset(0,3).addcomment somethinglikeant wrote: (1) If you want to loop through rng then yes what you have suggested as what you are writing will loop through the whole range off the back of rng.columns(2).select if you want to loop through this just write for each cell in selection (3) something like With ActiveCell.AddComment .Visible = True .Text "comments blah blah blah" End With 2 out of 3 aint bad somethinglikeant James Cornthwaite wrote: I have two three queries? FIRST If I say Dim rng As range Dim cell As range Set rng = range (A1: C:10) rng.columns(2).select "and then say" For Each cell in rng blah blah My question is does rng now just refer to column 2 or does it refer to the whole range object declared. I'm new to VBA (have done a little JAVA) and the statement rng.columns(2).select on its own seems odd. I would usually expect something more like rng = rng.columns(2).select but does just rng.columns(2).select basically just have that affect until some other function is called on the rng object? SECONDLY I have a variant which may hold a long. I know = cont(integer) will work for an integer, is there an equivalent for a long? THIRDLY If from question one, i have a cell (range object) in the for loop and want to add a comment to the right of that cell by three columns but same row how do i do it. I think i probably need the offset function? Something like For Each cell in rng cell = cell.offset(3,0) cell.addcommment ("comment") next cell MANY MANY THANKS James |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
yep the selection and activecell objects are very useful
James Cornthwaite wrote: ah so when i say rng.columns(2).select this is implying (without explicitly stating) selection = rng.columns(2).select Thanks James "somethinglikeant" wrote in message oups.com... sorry should have been activecell.offset(0,3).addcomment somethinglikeant wrote: (1) If you want to loop through rng then yes what you have suggested as what you are writing will loop through the whole range off the back of rng.columns(2).select if you want to loop through this just write for each cell in selection (3) something like With ActiveCell.AddComment .Visible = True .Text "comments blah blah blah" End With 2 out of 3 aint bad somethinglikeant James Cornthwaite wrote: I have two three queries? FIRST If I say Dim rng As range Dim cell As range Set rng = range (A1: C:10) rng.columns(2).select "and then say" For Each cell in rng blah blah My question is does rng now just refer to column 2 or does it refer to the whole range object declared. I'm new to VBA (have done a little JAVA) and the statement rng.columns(2).select on its own seems odd. I would usually expect something more like rng = rng.columns(2).select but does just rng.columns(2).select basically just have that affect until some other function is called on the rng object? SECONDLY I have a variant which may hold a long. I know = cont(integer) will work for an integer, is there an equivalent for a long? THIRDLY If from question one, i have a cell (range object) in the for loop and want to add a comment to the right of that cell by three columns but same row how do i do it. I think i probably need the offset function? Something like For Each cell in rng cell = cell.offset(3,0) cell.addcommment ("comment") next cell MANY MANY THANKS James |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
when you say activecell in (3) in the for loop is that the cell currently
being refered in that particular interation? thanks james "somethinglikeant" wrote in message oups.com... sorry should have been activecell.offset(0,3).addcomment somethinglikeant wrote: (1) If you want to loop through rng then yes what you have suggested as what you are writing will loop through the whole range off the back of rng.columns(2).select if you want to loop through this just write for each cell in selection (3) something like With ActiveCell.AddComment .Visible = True .Text "comments blah blah blah" End With 2 out of 3 aint bad somethinglikeant James Cornthwaite wrote: I have two three queries? FIRST If I say Dim rng As range Dim cell As range Set rng = range (A1: C:10) rng.columns(2).select "and then say" For Each cell in rng blah blah My question is does rng now just refer to column 2 or does it refer to the whole range object declared. I'm new to VBA (have done a little JAVA) and the statement rng.columns(2).select on its own seems odd. I would usually expect something more like rng = rng.columns(2).select but does just rng.columns(2).select basically just have that affect until some other function is called on the rng object? SECONDLY I have a variant which may hold a long. I know = cont(integer) will work for an integer, is there an equivalent for a long? THIRDLY If from question one, i have a cell (range object) in the for loop and want to add a comment to the right of that cell by three columns but same row how do i do it. I think i probably need the offset function? Something like For Each cell in rng cell = cell.offset(3,0) cell.addcommment ("comment") next cell MANY MANY THANKS James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
Long Long Long Nested If Function | Excel Discussion (Misc queries) | |||
More vlookup questions (I think?)(kind of long) | Excel Discussion (Misc queries) | |||
Clearing cells takes long, long time | Excel Discussion (Misc queries) | |||
A few VBA questions - long post! | Excel Discussion (Misc queries) |