Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Refer to cell in diff sheet

I have the following below, and I want If (cell.value) = "1034" to
refer to cell G2 in worksheet entitled "menu." How would I write
that, so it refers to the value in that cell. Thanks.

Sub Delete_Rows()
' This macro deletes all rows on the active worksheet
' that have 1034, 1035, 1037 column E.
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("E:E"), ActiveSheet.UsedRange)
For Each cell In rng
If (cell.Value) = "1034" _
Or (cell.Value) = "1035" _
Or (cell.Value) = "1037" Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next
On Error Resume Next
del.EntireRow.Delete
End Sub

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
How do I copying data from a cell on sheet to a diff cell/sheet Bowldiva120 Excel Worksheet Functions 1 March 21st 10 11:25 PM
Refer to a sheet using a cell value bony_tony Excel Worksheet Functions 2 July 11th 08 04:27 PM
refer to a cell in another sheet JT[_2_] Excel Programming 1 March 30th 05 05:28 PM
Excel VBA (?!)-refer to a cell on Sheet to left of X, based on criteria on Sheet X tempjones Excel Programming 2 June 7th 04 09:48 PM
Refer to a sheet in a cell Esben Excel Programming 3 May 26th 04 08:33 PM


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