LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to search for & select ranges to sum

Hi, Here is my dillemma (I'm a VBA newbie):

I have created a macro using VBA that takes raw data from an external excel
spreadsheet in the following form

Mark 28
Mark 32
Jim 13
Jim 57
Jim 84
Elliot 15
Jason 48
Jason 48
Jason 90
Jason 85

and transforms it into the following format into a new spreadsheet

Mark 28
Mark 32


Jim 13
Jim 57
Jim 84


Elliot 15


Jason 48
Jason 48
Jason 90
Jason 85

What I want the macro to then do is to go through and differentiate each
range from each other, then sum the values in each range in the cells
directly below each range. I need to use a macro because size and number of
ranges will vary. How do I program a macro so that it will go to the first
empty cell below each range and sum the values for that range?

Any help is appreciated,

Jason

I used the following programming to get the raw data into the format above:

Sub Import_Job_Log()
Application.DisplayAlerts = False
Application.Goto reference:="job_log_loc"
Selection.CurrentRegion.Select
Selection.Clear
Application.Goto reference:="job_log_loc"
mywindow = ActiveWorkbook.Name
myfile = Application.GetOpenFilename("microsoft excel files,*.xls")
Workbooks.Open Filename:=myfile
Selection.CurrentRegion.Select
Selection.Copy
myworkbook = ActiveWorkbook.Name
Windows(mywindow).Activate
ActiveSheet.Paste
Windows(myworkbook).Activate
ActiveWindow.Close
Application.Goto reference:="format"
Selection.EntireRow.Hidden = False
Selection.End(xlUp).Select
Range("E3").Select
Do Until ActiveCell = "stop"
If ActiveCell = ActiveCell.Offset(1, 0) = False Then
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
End If
ActiveCell.Offset(1, 0).Select
Loop


 
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
Macro to select Range to protect and unprotect ranges [email protected] Excel Worksheet Functions 2 May 15th 09 06:04 AM
Can COUNTIF be nested to search two ranges Jimbob Excel Worksheet Functions 4 November 1st 06 05:23 PM
allow search on ranges of values gloss Excel Worksheet Functions 0 May 9th 06 07:08 AM
How to write a macro to select print ranges that vary monthly wilson@irco[_2_] Excel Programming 8 February 27th 06 05:03 PM
Conditional Formula to search ranges?? adean Excel Discussion (Misc queries) 2 December 13th 04 10:53 PM


All times are GMT +1. The time now is 06:17 AM.

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"