#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default VB Question

I'm trying to get some help with VB code that auto-fills cell C2 through the
cell in column C where the word "Total" appears in colum A.

In this example, it would begin in cell C2 and needs to Auto-Fill down to
Row 4 since Cell A4 contains the word "Total"

Column A Column B Column C
row1 Test1 5 30%
row2 Test2 3
row3 Test3 7
row4 Total 15

Here's what I have so far although I need the range to be through the row
where the word "Total" appears in column A.

Range("C2").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("C2:C47")
Range("C2:C47").Select



Many thanks if you can help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default VB Question

Maybe...

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row - 1
.range("C2").autofill destination:=.range("c2:C" & lastrow)
end with

It actually just looks at the last used row in column A, then subtracts 1. So
if you have data in column A under the Total row, this won't work.

Stan wrote:

I'm trying to get some help with VB code that auto-fills cell C2 through the
cell in column C where the word "Total" appears in colum A.

In this example, it would begin in cell C2 and needs to Auto-Fill down to
Row 4 since Cell A4 contains the word "Total"

Column A Column B Column C
row1 Test1 5 30%
row2 Test2 3
row3 Test3 7
row4 Total 15

Here's what I have so far although I need the range to be through the row
where the word "Total" appears in column A.

Range("C2").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("C2:C47")
Range("C2:C47").Select

Many thanks if you can help!


--

Dave Peterson
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
Another IF Question [email protected] Excel Worksheet Functions 3 December 19th 06 04:58 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
The question is an excel question that I need to figure out howto do in excel. Terry Excel Worksheet Functions 3 January 23rd 06 06:22 PM
My first question! Deadloss Excel Discussion (Misc queries) 10 December 23rd 05 05:41 AM
Question Please. Steved Excel Worksheet Functions 2 December 5th 05 06:04 PM


All times are GMT +1. The time now is 03:21 AM.

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"