PC Review


Reply
Thread Tools Rate Thread

Cahnging the CONSTR Variable

 
 
=?Utf-8?B?VmV4ZWRGaXN0?=
Guest
Posts: n/a
 
      8th Apr 2007
I am using this attached Macro to delete unwanted rwos from my worksheet
leaving me with jst the iformation pertaing to what is in the SAVESTR. I run
this Macro on multiple Worksheets and the SAVESTR neeeds to change for each
one.

I need to be able to change SAVESTR depending on the value in another
worksheet. For example if the Value in cell C2 of the "RCM" Workheet is
greather than NULL than that value becomes the SAVESTR Variable.

Sub DupShelf()
'
' DupShelf Macro
' Macro Created On by Ralph M. Hill @ Siemens Managed Services Helpdesk
'

'
Const SAVESTR As String = "Main Hub"
Dim sSave As String
Dim myRange As Range
Dim cell As Range
Dim delRange As Range

Sheets("Sheet1").Select
Range("B1").FormulaR1C1 = SAVESTR
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("Hardware (10)").Activate
Columns("I:I").Select
On Error Resume Next
Selection.Find(What:=SAVESTR, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
If Err.Number <> 91 And Err.Number <> 0 Then
MsgBox "Unresolved Error"
Exit Sub
End If
If ActiveCell.Row > 1 Then
Set myRange = Range("I1").Resize(Range( _
"I" & Rows.Count).End(xlUp).Row, 1)
For Each cell In myRange
If cell.Value <> SAVESTR Then
If delRange Is Nothing Then
Set delRange = cell
Else
Set delRange = Union(delRange, cell)
End If
End If
Next cell
If Not delRange Is Nothing Then delRange.EntireRow.Delete
Range("B1").Select
Selection.EntireRow.Insert
Else
ActiveWindow.SelectedSheets.Delete
End If
Application.ScreenUpdating = False
End Sub

Any and all suggestions will be appreciated.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone have an "RFI" (request for information) template for constr vondude Microsoft Access Forms 1 2nd Jul 2008 07:22 AM
Bug report: Table fields of type MEMO are chunked 'cause of CONSTR =?Utf-8?B?UGV0ZXI=?= Microsoft Access Queries 3 7th Oct 2007 05:00 PM
SqlConnection Object in Application Variable OR Session Variable OR open/close pratham Microsoft ASP .NET 3 31st Aug 2006 08:26 PM
Cahnging the 'page number'ing language =?Utf-8?B?c2FlZWRzdGFy?= Microsoft Word Document Management 7 10th May 2006 11:38 PM
CAHNGING INTERNET IPO Windows XP Networking 1 28th Apr 2004 06:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:01 PM.