Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA for finding separated ranges of data in sheet

I am trying to determine VBA code that would allow me to:

1. Find the start and end of ranges of data that are separated by several
empty empty rows. Each seperate range is a region of information that will
be treated differently in subsequent code and formulas. I have the VBA code
insert 20 blank rows at the top of the page for later use to insert formulas
summarizing data calculations.
2. For the data regions, I need to name the ranges by column and region.
Each column contains the same type of data but each region represents a group
of the data type. The challenge is that the number of rows in each range
varies each day that I will run the code. So I have to define the range
names by the variable start and end row numbers of each region. I need the
number of rows scalable from 1 to at least 500 each.
3. I want to delete the empty rows between the ranges (i.e. put the ranges
regions together) and name the new continuous region by column from its first
row to its last row.
4. I want to be able to force a SUMPRODUCT formula using the range names
into selected cells at the top of the spreadsheet. I know the formula I want
pasted into each selected cell, I just don't know the VBA code required to
paste a formula in the cell. Can you give me an example line with an example
formula?

The preceding is asking alot but I've done a little VBA coding already that
gets close but not quite there. Any suggestions for any one of the above is
appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default VBA for finding separated ranges of data in sheet

Try this, able to name ranges (6,1) would be start of range
you can control how far up/down or left/right it goes by adding numbers
after rows.count or column.count

Range("A6").Select
Set RangeToCheck = ActiveCell.CurrentRegion
Set NewRange = Range(RangeToCheck.Cells(6, 1), _
RangeToCheck.Cells(RangeToCheck.Rows.Count, _
RangeToCheck.Columns.Count))
ActiveWorkbook.Names.Add Name:="AllData", RefersToR1C1:=NewRange
--
Helping Is always a good thing


"BJTex" wrote:

I am trying to determine VBA code that would allow me to:

1. Find the start and end of ranges of data that are separated by several
empty empty rows. Each seperate range is a region of information that will
be treated differently in subsequent code and formulas. I have the VBA code
insert 20 blank rows at the top of the page for later use to insert formulas
summarizing data calculations.
2. For the data regions, I need to name the ranges by column and region.
Each column contains the same type of data but each region represents a group
of the data type. The challenge is that the number of rows in each range
varies each day that I will run the code. So I have to define the range
names by the variable start and end row numbers of each region. I need the
number of rows scalable from 1 to at least 500 each.
3. I want to delete the empty rows between the ranges (i.e. put the ranges
regions together) and name the new continuous region by column from its first
row to its last row.
4. I want to be able to force a SUMPRODUCT formula using the range names
into selected cells at the top of the spreadsheet. I know the formula I want
pasted into each selected cell, I just don't know the VBA code required to
paste a formula in the cell. Can you give me an example line with an example
formula?

The preceding is asking alot but I've done a little VBA coding already that
gets close but not quite there. Any suggestions for any one of the above is
appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA for finding separated ranges of data in sheet

I am probably missing something in your response. My code finds the start
and end of the first variable range of rows and fixed number of columns. My
primary problem is that I don't know how to then determine the number of
blank rows until the next range of data and then start with the next
non-empty row and column A as my anchor cell for the second variable range of
rows. Once that second range starting row and ending row is known, I can
then use Offset to successively name each needed range of columns to the
right. I just didn't get that solution from your response. Thanks.

"QuietMan" wrote:

Try this, able to name ranges (6,1) would be start of range
you can control how far up/down or left/right it goes by adding numbers
after rows.count or column.count

Range("A6").Select
Set RangeToCheck = ActiveCell.CurrentRegion
Set NewRange = Range(RangeToCheck.Cells(6, 1), _
RangeToCheck.Cells(RangeToCheck.Rows.Count, _
RangeToCheck.Columns.Count))
ActiveWorkbook.Names.Add Name:="AllData", RefersToR1C1:=NewRange
--
Helping Is always a good thing


"BJTex" wrote:

I am trying to determine VBA code that would allow me to:

1. Find the start and end of ranges of data that are separated by several
empty empty rows. Each seperate range is a region of information that will
be treated differently in subsequent code and formulas. I have the VBA code
insert 20 blank rows at the top of the page for later use to insert formulas
summarizing data calculations.
2. For the data regions, I need to name the ranges by column and region.
Each column contains the same type of data but each region represents a group
of the data type. The challenge is that the number of rows in each range
varies each day that I will run the code. So I have to define the range
names by the variable start and end row numbers of each region. I need the
number of rows scalable from 1 to at least 500 each.
3. I want to delete the empty rows between the ranges (i.e. put the ranges
regions together) and name the new continuous region by column from its first
row to its last row.
4. I want to be able to force a SUMPRODUCT formula using the range names
into selected cells at the top of the spreadsheet. I know the formula I want
pasted into each selected cell, I just don't know the VBA code required to
paste a formula in the cell. Can you give me an example line with an example
formula?

The preceding is asking alot but I've done a little VBA coding already that
gets close but not quite there. Any suggestions for any one of the above is
appreciated.

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
Finding Problems in Comma Separated List Daren Excel Worksheet Functions 5 January 9th 09 05:22 PM
How can Enter Page Numbers and/or page ranges separated by commas. d Excel Discussion (Misc queries) 1 December 3rd 08 03:41 PM
Finding max from different ranges of data owen080808 Excel Discussion (Misc queries) 2 April 5th 06 11:00 AM
Finding data in a different sheet trem Excel Discussion (Misc queries) 1 March 7th 06 02:21 PM
Finding maximum of various ranges of data thekovinc Excel Discussion (Misc queries) 2 January 23rd 06 08:41 PM


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