Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel writting Ken Excel Discussion (Misc queries) 2 June 12th 07 10:34 PM
Help with writting macro nc Excel Programming 1 November 29th 05 10:01 AM
Help with writting macro nc Excel Discussion (Misc queries) 0 November 28th 05 02:45 PM
Help with writting macro nc Excel Discussion (Misc queries) 0 November 28th 05 11:41 AM
Help writting a macro Gerald[_2_] Excel Programming 3 August 11th 05 04:56 AM


All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"