Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
writting data in the next available column
there are many ways to do this, btu all are generally variations on 2
themes: a) using .end(xlright) - basically going to the far end of the spreadsheet and then going back to the left to find the last cell with something in it b) look for cells with data and go to the next column - presumabley blank. both ways have pluses and minuses. i prefer B as it doesn't rely on cells outside your table always being blank my favorite way is to use a self-resetting named range. to do this you use a named range in the workbook that resets itself each time a new column of data is added to the table. this works wether you do it manually or by macro. Sub y() ThisWorkbook.Names.Add Name:="Banana", RefersTo:="=OFFSET(Sheet1!$A$2,0,COUNTA(Sheet1!$2: $2),10,1)" Set rng = Range("Banana") rng.Select For i = 1 To 10 rng.Cells(i, 1) = i Next i End Sub an alternative - if you don't want to use a named range is to use the ..currentregion method Set rng = Sheet1.Cells(1, 1).CurrentRegion.Offset(0, 1).Resize(rowsize:=10) - voodooJoe "yorke" wrote in message oups.com... hello, i'm creating a weekly reporting and have my weeks (1-52) lined up from column D (week 1) to ... Each week I want my VbA macro to add data to the next availabel (= blank) column, i already created a form with all the data (labels) that have to go in the right column. Your response in english or Nederlands !! thx |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
writting data in the next available column
hello,
i'm creating a weekly reporting and have my weeks (1-52) lined up from column D (week 1) to ... Each week I want my VbA macro to add data to the next availabel (= blank) column, i already created a form with all the data (labels) that have to go in the right column. Your response in english or Nederlands !! thx |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel writting | Excel Discussion (Misc queries) | |||
Help with writting macro | Excel Programming | |||
Help with writting macro | Excel Discussion (Misc queries) | |||
Help with writting macro | Excel Discussion (Misc queries) | |||
Help writting a macro | Excel Programming |