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: 23
Default Variables being randomly destroyed

I have this code that I was assigned some time ago (I didn't write it
myself)... What is happening when I add watches for variables nm,
nmtrust is that I see they are being randomly assigned values like
'??????r', 'VBAProject' while I step thru the code. Any ideas why
that would happen?

It does not happen on my machine, but two other machines is is
happening. All machines are XP Professional SP2, office 2003 SP2. The
machines it is happening to are P4 2.8 Ghz, w/ 512 MB Ram and plenty
of HD Space avail.

Note: Option explicit is not turned on, and it would be quite a mess
to turn it on. The staff that wrote this code didn't do anything very
standard. No comments or docs when I took this code over.

Sub putRedSub()
On Error Resume Next
dater1 = Format(Range("A75").Value, "mm/dd/yyyy")
''If dater1 = Format(Now(), "mm/dd/yyyy") Then
'' GoSub getSubs
''Else
''End If

GoSub getSubs
y = 1
While wTrust.Offset(0, y).Value < ""
nmtrust = wTrust.Offset(0, y).Value
If IsNumeric(nmtrust) Then
nm = Trim(Str(nmtrust))

Else
unchar = InStr(1, nmtrust, "-", vbTextCompare)
If Not unchar = 5 Then
nm = Left$(nmtrust, 5) & "_" & Mid$(nmtrust, 7, 2) & "_" & Mid$
(nmtrust, 10, 1)
nm = Replace(nm, " ", "")
nm = Replace(nm, "-", "_")
' GoSub PutValue
Else
End If
End If

wSubscription.Offset(0, y).FormulaR1C1 = "=_DSTsource.xls!sb" & nm
If Left(Str(wSubscription.Offset(0, y).Value), 5) = "Error" Then
wSubscription.Offset(0, y).Value = Null
Else: End If

wSubscription.Offset(1, y).FormulaR1C1 = "=_DSTsource.xls!rd" & nm
If Left(Str(wSubscription.Offset(1, y).Value), 5) = "Error" Then
wSubscription.Offset(1, y).Value = Null
Else: End If

' ActiveCell.FormulaR1C1 = "=_DSTsource.xls!rd09303_02_L"
y = y + 1
Wend
With Range(wSubscription, wSubscription.Offset(1, y))
.Copy
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
Application.CutCopyMode = False
Exit Sub

getSubs:
Set regions1 = Range("b4").CurrentRegion
Set wSubscription = Range("a:a").Find(What:="Subscription",
After:=Range("a1"), LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False)
wSubscription.Select

'While wSubscription.Offset(0, 1)

Set wTrust = Range("a:a").Find(What:="TRUST ACCT", After:=Range("a1"),
LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False)
wTrust.Select
Located = Range(wSubscription, wTrust).Rows.Count - 1
Debug.Print Located
'Located.Select
Return
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
Import of text file - numbers destroyed! [email protected] Excel Discussion (Misc queries) 2 February 12th 08 09:17 PM
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
Floating commandbar problem -- toolbars destroyed only if sheet first upon opening ... ? StargateFanFromWork[_4_] Excel Programming 1 October 30th 06 08:15 PM
Global variable destroyed when form closed [email protected] Excel Programming 2 August 25th 06 11:57 AM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM


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