Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Column Searching


I am looking for a way to find any time "weekly subtotal" is found in
column (A). If it is found for the given row I want to sum Columns
D,E,and F from the first date to the row with the "weekly subtotal in
it.

01/02/2006
01/02/2006
01/03/2006
01/03/2006
01/04/2006
01/05/2006
01/06/2006
01/06/2006
Weekly Subtotal (SUM D1:D8) (SUM E1:E8) (SUM
F1:F8)
01/09/2006
01/10/2006
01/11/2006
01/12/2006
01/13/2006
Weekly Subtotal (SUM D10:D14) (SUM E10:E14) (SUM
F10:F14)

Can anyone Help? PLEASE


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=519594

  #2   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 107
Default Column Searching

try this, not very neat

Dim i
Dim thisrow

Sub Macro1()

lastrow = Range("a65536").End(xlUp).Row
Range("A1").Select
Columns("A:A").Select
Selection.Find(What:="weekly", After:=ActiveCell).Activate
thisrow = ActiveCell.Row
i = i + 1
insertformula
Do While thisrow < lastrow
i = thisrow + 1
Selection.Find(What:="weekly", After:=ActiveCell).Activate
thisrow = ActiveCell.Row
insertformula
Loop
End Sub

Sub insertformula()
Range("B" & thisrow).Formula = "=sum(B" & i & ":B" & thisrow - 1 & ")"
Range("C" & thisrow).Formula = "=sum(C" & i & ":C" & thisrow - 1 & ")"
Range("D" & thisrow).Formula = "=sum(D" & i & ":D" & thisrow - 1 & ")"
End Sub


"parteegolfer" wrote:


I am looking for a way to find any time "weekly subtotal" is found in
column (A). If it is found for the given row I want to sum Columns
D,E,and F from the first date to the row with the "weekly subtotal in
it.

01/02/2006
01/02/2006
01/03/2006
01/03/2006
01/04/2006
01/05/2006
01/06/2006
01/06/2006
Weekly Subtotal (SUM D1:D8) (SUM E1:E8) (SUM
F1:F8)
01/09/2006
01/10/2006
01/11/2006
01/12/2006
01/13/2006
Weekly Subtotal (SUM D10:D14) (SUM E10:E14) (SUM
F10:F14)

Can anyone Help? PLEASE


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=519594


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Column Searching

Hi,
Try this:

Dim rng As Range
Dim lastrow As Long, r As Long, i As Integer
With Worksheets("Sheet1")
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
r = 1
srow = r
Do
Do
r = r + 1
Loop Until .Cells(r, "a") = "Weekly Subtotal" Or r = lastrow
For i = 4 To 6
Set rng = .Range(.Cells(srow, i), .Cells(r - 1, i))
Cells(r, i) = Application.Sum(rng)
Next i
srow = r + 1
Loop Until srow lastrow
End With

"parteegolfer" wrote:


I am looking for a way to find any time "weekly subtotal" is found in
column (A). If it is found for the given row I want to sum Columns
D,E,and F from the first date to the row with the "weekly subtotal in
it.

01/02/2006
01/02/2006
01/03/2006
01/03/2006
01/04/2006
01/05/2006
01/06/2006
01/06/2006
Weekly Subtotal (SUM D1:D8) (SUM E1:E8) (SUM
F1:F8)
01/09/2006
01/10/2006
01/11/2006
01/12/2006
01/13/2006
Weekly Subtotal (SUM D10:D14) (SUM E10:E14) (SUM
F10:F14)

Can anyone Help? PLEASE


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=519594


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Column Searching


Thanks Toppers, This worked out well for me. All i had to do was change
the worksheet name. Once again, thanks


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=519594

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
Searching up a column Mike Rogers[_2_] Excel Discussion (Misc queries) 7 December 31st 07 03:46 PM
Searching One Column Only [email protected] Excel Discussion (Misc queries) 2 August 31st 06 12:17 PM
Searching a column Robert Pollock[_2_] Excel Programming 2 July 12th 04 01:54 PM
Searching a Column ToddG Excel Programming 3 June 14th 04 08:51 PM
Searching In a Column KC[_3_] Excel Programming 4 April 15th 04 02:54 PM


All times are GMT +1. The time now is 03:56 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"