LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default maintaining the value of a variable outside of an if construct...

Sub test()
Dim rng As Range
Dim x As Integer
Dim i As Range


Sheets("Workforce Data Table").Select
ActiveSheet.ListObjects( _
"WDT").Range. _
AutoFilter Field:=2, Criteria1:="Grave"

Range("A1").Select
Set RANGEENTRIES = Range("A1", ActiveCell.End(xlDown))
RANGEENTRIES.Select
Do While x <= NUMENTRIES
For Each cell In Selection
If ActiveCell.EntireRow.Hidden = False Then
x = x + 1
Set i = ActiveCell
Sheets("Monthly Management Report").Select
Range("B46").Select
ActiveCell.Cells(x, 0).Select

ActiveCell.Value = i
End If
i.Select 'This line fails, I'm assuming because my
variable i loses it's

'value outside of the if construct...
ActiveCell.Offset(1, 0).Select
Next cell
Loop

End Sub
 
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
Public Variable not maintaining value. Mark Excel Programming 1 September 7th 05 07:16 PM
Maintaining cell 'variable' values even after the the macro has en tomwashere2 Excel Programming 1 August 18th 05 11:44 PM
if else construct Ian Bartlett Excel Worksheet Functions 2 July 22nd 05 01:16 PM
Maintaining VBA variable values Adam1 Chicago Excel Discussion (Misc queries) 3 March 14th 05 11:08 PM
How to construct for best speed? Stuart[_5_] Excel Programming 4 September 3rd 03 07:20 PM


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