LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automatically copy down a column

Again I have to thank this great access group at
http://www.utteraccess.com/forums
for the answer to my problem and I hope that this will help someone else.
The answer that worked for me:

Sub fill_Job_num()

'This macro written 2-4-05 by Paul Hannah of Excelsior Servies _
'for Anne and may be copied or edited however you like.
'The macro was written with these assuming, The text not to copy start with
"Total" and
'Only empty cells get copied to.

Dim strLastNM As String 'holds the value to be copied, changes when a new
one shows up
Dim lngLastRow As Long 'holds the last row number used by the sheet.
Dim curcel As Variant 'holds the position of the loop.
'get last row number
lngLastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row

'Start a Loop that will run form A2 to the last row in column A
For Each curcel In Range("a2:a" & lngLastRow)
If curcel < "" And Left(curcel, 5) < "Total" Then 'look for the next
job num
strLastNM = curcel 'Get the next job number
ElseIf curcel = "" Then 'if the cell is empty
curcel.Formula = strLastNM ' enter the last job number
End If
Next curcel
'loop back for the next cell
'that's it. Have fun.

End Sub

My pleasure to pass it on
Anne

"Rob" wrote in message
...
Ann,

Not sure whether this will help but if you add a column, say A and
assuming data starts at row 2, the following entered and copied down will
return what you need. You can then copy paste value to column B and
delete column A.

=IF(LEN(B2)0,B2,A1)

The above could be accomplished with VBA but I'm not too sure how. Rob

"Anne" wrote in message
...
I put this to the worksheet.functions in error. I need to do this with a
macro.
I am working with a spreadsheet exported from Quickbooks and I am trying
to
prepare the sheet to import into Access.
The jobNo (Col A) comes from a header and I need to copy this field to
each
row which has the employee work info.
A B C D
133 (1st job header)
Empl Date Hrs
Empl Date Hrs
Empl Date Hrs
Empl Date Hrs
133 (1st job footer)
144 (next job header )
Empl Date Hrs
Empl Date Hrs
144 (next job footer)
145 (next job header)
etc
The problem is, that each week the number of jobs varies, so there has to
be a stop value.
Any help is appreciated.
Anne







 
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
Automatically copy formula in column when adding new row.... Jasmine R Excel Worksheet Functions 2 March 31st 10 06:24 PM
Copy formula with row automatically modified not column Paul Excel Worksheet Functions 4 March 4th 09 01:35 AM
copy automatically Hardeep_kanwar Excel Discussion (Misc queries) 0 May 19th 08 05:58 PM
How to automatically copy VLOOKUP FORMULA IN A COLUMN klafert Excel Discussion (Misc queries) 0 May 9th 07 08:45 AM
AUTOMATICALLY CHOOSE COLUMN H OR G DEPENDANT ON CONTENT IN COLUMN. Tigers Excel Programming 1 November 1st 04 04:56 PM


All times are GMT +1. The time now is 06:23 PM.

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

About Us

"It's about Microsoft Excel"