Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default not sure on constants

this is what I wrote but it will clear formulas would someone inject the
change needed into one place. Then i can see what needs to be done. There is
a lot more to this.
Thanks Much

Selection.ClearContents
Worksheets("Data").Activate
Range("C4:L100").Select
Worksheets("MailE").Activate
Range("A2:E100").Select
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default not sure on constants

So you want to clear all of the constants from a given range but leave the
formulas in tact???

Sub ClearConstants()
Dim rngConstants As Range

On Error Resume Next
Set rngConstants = Range("A1:C10").SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
End Sub
--
HTH...

Jim Thomlinson


"Curt" wrote:

this is what I wrote but it will clear formulas would someone inject the
change needed into one place. Then i can see what needs to be done. There is
a lot more to this.
Thanks Much

Selection.ClearContents
Worksheets("Data").Activate
Range("C4:L100").Select
Worksheets("MailE").Activate
Range("A2:E100").Select

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default not sure on constants

still confused will enclose complete will you tell me if I am going right way
Thank You

Selection.ClearContents
Worksheets("Data").Activate
Range("C4:L100").Select
Worksheets("MailE").Activate
Range("A2:E100").Select
Worksheets("MailD").Activate
Range("A2:F100").Select
Worksheets("Motorcycle").Activate
Range("A2:H60").Select
Worksheets("Indian").Activate
Range("A2:H60").Select
Worksheets("Native").Activate
Range("A2:H60").Select
Worksheets("Donors").Activate
Range("A2:H60").Select
Worksheets("Desc").Activate
Range("A2").Select
Worksheets("Limo Bios").Activate
Range("b3,b5,b7,b9,b11,b13,b15,b17").Select
Worksheets("Balance").Activate
Sub ClearConstants()
Dim rngConstants As Range

On Error Resume Next
Set rngConstants = Range("E3:E30").SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
End Sub
'Range("E3:E30").Select
End Sub


"Jim Thomlinson" wrote:

So you want to clear all of the constants from a given range but leave the
formulas in tact???

Sub ClearConstants()
Dim rngConstants As Range

On Error Resume Next
Set rngConstants = Range("A1:C10").SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
End Sub
--
HTH...

Jim Thomlinson


"Curt" wrote:

this is what I wrote but it will clear formulas would someone inject the
change needed into one place. Then i can see what needs to be done. There is
a lot more to this.
Thanks Much

Selection.ClearContents
Worksheets("Data").Activate
Range("C4:L100").Select
Worksheets("MailE").Activate
Range("A2:E100").Select

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default not sure on constants

I'm still a bit confused exactly what you want, but this code will clear out
the constants from all of the ranges you have specified in your code...

Sub ClearRanges()

Call ClearConstants(Worksheets("Data").Range("C4:L100") )
Call ClearConstants(Worksheets("MailE").Range("A2:E100" ))
Call ClearConstants(Worksheets("MailD").Range("A2:F100" ))
Call ClearConstants(Worksheets("Motorcycle").Range("A2: E100"))
Call ClearConstants(Worksheets("Indian").Range("A2:H60" ))
Call ClearConstants(Worksheets("Native").Range("A2:H60" ))
Call ClearConstants(Worksheets("Donors").Range("A2:H60" ))
Call ClearConstants(Worksheets("Desc").Range("A2"))
Call ClearConstants(Worksheets("Limo
Bios").Range("b3,b5,b7,b9,b11,b13,b15,b17"))
Call ClearConstants(Worksheets("MailE").Range("A2:E100" ))

Worksheets("Balance").Activate

End Sub

Sub ClearConstants(rng As Range)
Dim rngConstants As Range

On Error Resume Next
Set rngConstants = rng.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
End Sub

--
HTH...

Jim Thomlinson


"Curt" wrote:

still confused will enclose complete will you tell me if I am going right way
Thank You

Selection.ClearContents
Worksheets("Data").Activate
Range("C4:L100").Select
Worksheets("MailE").Activate
Range("A2:E100").Select
Worksheets("MailD").Activate
Range("A2:F100").Select
Worksheets("Motorcycle").Activate
Range("A2:H60").Select
Worksheets("Indian").Activate
Range("A2:H60").Select
Worksheets("Native").Activate
Range("A2:H60").Select
Worksheets("Donors").Activate
Range("A2:H60").Select
Worksheets("Desc").Activate
Range("A2").Select
Worksheets("Limo Bios").Activate
Range("b3,b5,b7,b9,b11,b13,b15,b17").Select
Worksheets("Balance").Activate
Sub ClearConstants()
Dim rngConstants As Range

On Error Resume Next
Set rngConstants = Range("E3:E30").SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
End Sub
'Range("E3:E30").Select
End Sub


"Jim Thomlinson" wrote:

So you want to clear all of the constants from a given range but leave the
formulas in tact???

Sub ClearConstants()
Dim rngConstants As Range

On Error Resume Next
Set rngConstants = Range("A1:C10").SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
End Sub
--
HTH...

Jim Thomlinson


"Curt" wrote:

this is what I wrote but it will clear formulas would someone inject the
change needed into one place. Then i can see what needs to be done. There is
a lot more to this.
Thanks Much

Selection.ClearContents
Worksheets("Data").Activate
Range("C4:L100").Select
Worksheets("MailE").Activate
Range("A2:E100").Select

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
Excel Constants Peter Excel Programming 0 April 25th 06 03:28 AM
Flagging constants [email protected] Excel Worksheet Functions 2 April 3rd 06 07:42 PM
constants Confused Excel Discussion (Misc queries) 3 December 2nd 04 05:05 PM
constants alekm Excel Programming 1 September 9th 04 12:16 PM


All times are GMT +1. The time now is 10:54 PM.

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"