Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Selecting Range of Cells

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Selecting Range of Cells

It would help if we could see what you have. Maybe a do.. loop through some
named ranges would do the trick?

"Harlan" wrote:

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Selecting Range of Cells

This is what I have so far:

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate
Range("C:C").Select

The constants are the names of the headings that span across multiple joined
cells. I'm trying to select all the data in column C that is a number and
delete it.
Thanks

"Office_Novice" wrote:

It would help if we could see what you have. Maybe a do.. loop through some
named ranges would do the trick?

"Harlan" wrote:

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Selecting Range of Cells

I am guessing that the range changes and that is what is causeing the trouble?

"Harlan" wrote:

This is what I have so far:

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate
Range("C:C").Select

The constants are the names of the headings that span across multiple joined
cells. I'm trying to select all the data in column C that is a number and
delete it.
Thanks

"Office_Novice" wrote:

It would help if we could see what you have. Maybe a do.. loop through some
named ranges would do the trick?

"Harlan" wrote:

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Selecting Range of Cells

Actually what is causing the trouble right now is that because I have cells
that are joined and span the entire range of columns (A:E), if I try to
select just column C all columns will become selected. But yes, the other
problem is that rows will be periodically added to and subtracted from the
sheet, but I still want to select only the cells in column C that contain
numbers.



"Office_Novice" wrote:

I am guessing that the range changes and that is what is causeing the trouble?

"Harlan" wrote:

This is what I have so far:

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate
Range("C:C").Select

The constants are the names of the headings that span across multiple joined
cells. I'm trying to select all the data in column C that is a number and
delete it.
Thanks

"Office_Novice" wrote:

It would help if we could see what you have. Maybe a do.. loop through some
named ranges would do the trick?

"Harlan" wrote:

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Selecting Range of Cells

Try this,
Option Explicit

Sub YourMacro()

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate

On Error Resume Next
Range("C:C").Cells.SpecialCells(xlCellTypeConstant s, xlNumbers).ClearContents


End Sub


"Harlan" wrote:

Actually what is causing the trouble right now is that because I have cells
that are joined and span the entire range of columns (A:E), if I try to
select just column C all columns will become selected. But yes, the other
problem is that rows will be periodically added to and subtracted from the
sheet, but I still want to select only the cells in column C that contain
numbers.



"Office_Novice" wrote:

I am guessing that the range changes and that is what is causeing the trouble?

"Harlan" wrote:

This is what I have so far:

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate
Range("C:C").Select

The constants are the names of the headings that span across multiple joined
cells. I'm trying to select all the data in column C that is a number and
delete it.
Thanks

"Office_Novice" wrote:

It would help if we could see what you have. Maybe a do.. loop through some
named ranges would do the trick?

"Harlan" wrote:

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Selecting Range of Cells

That works perfect. Thanks.

"Office_Novice" wrote:

Try this,
Option Explicit

Sub YourMacro()

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate

On Error Resume Next
Range("C:C").Cells.SpecialCells(xlCellTypeConstant s, xlNumbers).ClearContents


End Sub


"Harlan" wrote:

Actually what is causing the trouble right now is that because I have cells
that are joined and span the entire range of columns (A:E), if I try to
select just column C all columns will become selected. But yes, the other
problem is that rows will be periodically added to and subtracted from the
sheet, but I still want to select only the cells in column C that contain
numbers.



"Office_Novice" wrote:

I am guessing that the range changes and that is what is causeing the trouble?

"Harlan" wrote:

This is what I have so far:

Const BackKitchen As String = "Back Kitchen"
Const FrontLine As String = "Front Line"
Const WalkIn As String = "Walk In"
Const FOH As String = "FOH"
Const RackA As String = "Rack A"
Const RackB As String = "Rack B"
Const RackC As String = "Rack C"
Const RackD As String = "Rack D"
Const RackE As String = "Rack E"
Const RackF As String = "Rack F"
Const SpeedRacks As String = "Speed Racks"
Const DownstairsFreezer As String = "Downstairs Freezer"

Worksheets("Inventory Locations").Activate
Range("C:C").Select

The constants are the names of the headings that span across multiple joined
cells. I'm trying to select all the data in column C that is a number and
delete it.
Thanks

"Office_Novice" wrote:

It would help if we could see what you have. Maybe a do.. loop through some
named ranges would do the trick?

"Harlan" wrote:

I'm trying to write a macro that will select a certain range of cells. The
problem is, new rows will be added to and subtracted from the worksheet. But
i still want to be able to have this macro select a certain range, all in one
column and then clear the contents of that range.
Also, I have cells throughout the sheet that are grouped and span the length
of the sheet. These cells have text in them, and that text is constant, will
not change and are group headings.
I'm guessing I have to have the macro select the cells in the specified row
between two constants, then clear the contents and then go on to the next
section. I'm just not completely sure how to do that.
I'm new to VBA and have some VB experience. I understand some of the
constants.
Thanks
I hope I'm not asking too much.

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
Selecting a range of cells , how to ? Luc Excel Programming 1 February 23rd 07 07:30 PM
Range selecting cells Alec H Excel Discussion (Misc queries) 2 March 14th 06 01:36 PM
selecting a range of cells Grandma Barb[_3_] Excel Programming 1 March 5th 05 02:52 AM
Selecting a Range of cells in VBA spacecityguy[_4_] Excel Programming 3 August 30th 04 04:14 PM
Selecting a range of cells Kevin Excel Programming 5 October 10th 03 03:03 PM


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