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: 72
Default range not carrying over

I've written this code to run a userform and capture a range for the
user to identify before the code turns over to some module code. But
the variable "rExtrFromStrt" doesn't carry over to the other module.
I"m getting a "variable not defined" message in the next module. Any
suggestions?

Option Explicit
Public rColStart As Range
Public rExtrFromStrt As Range
Public rExtrFromEnd As Range
Public lLastCol As Long
Public lLastRow As Long
Public lUsrSelectRow As Long
Public s1stCtyName As String
'Public bHdr As Boolean

Private Sub btnCancel_Click()
End
End Sub

Private Sub btnTop21BOS_Click()

End Sub

Private Sub CheckBox1_Click()
bHdr = True
End Sub

Sub OKButton_Click()
Dim rFndCell As Range
Dim lStrDif As Long

If btnTop10BOS Then lTop = 10
If btnTop21BOS Then lTop = 21
If btnTop10MidBOS Then lTop = 3

If lTop = 0 Then
MsgBox "Please select the type of extraction (i.e., Top 10, BOS)
you want."
Exit Sub
End If

If reDataStrt = "" Then
MsgBox "Please select the range where the first county, " _
& "Adams, data is located."
Exit Sub
End If

Set uf1021Mid.rColStart = Range(reDataStrt.Text)

Set rFndCell = uf1021Mid.rColStart.Rows(1).Find(What:="Adams", _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=False)
If rFndCell Is Nothing Then
MsgBox "The first row of data should include Adams County. " _
& "Please select the correct row."
Exit Sub
End If

s1stCtyName = rFndCell.Value

'If UCase(s1stCtyName) < "ADAMS" Then
If UCase(s1stCtyName) Like "*ADAMS" Then
lStrDif = Len(s1stCtyName) - 5
s1stCtyName = Right(s1stCtyName, Len(s1stCtyName) - lStrDif)
Else
If MsgBox("No ADAMS county found in county list!",
vbRetryCancel) _
= vbCancel Then
Exit Sub
Else
Application.ScreenUpdating = True

End If

End If

With uf1021Mid.rColStart
lLastCol = .Columns(.Columns.Count).Column
End With

Set rExtrFromStrt = uf1021Mid.rColStart

If rExtrFromStrt Is Nothing Then
Exit Sub 'user hit cancel
End If
rExtrFromStrt.Select
If cbHdr = True Then
'MsgBox "true"
bHdr = True

End If
uf1021Mid.Hide
 
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
Carrying last $$$ amount to another field Challenged Excel Worksheet Functions 4 April 13th 09 07:01 AM
Carrying data over in worksheets roxiemayfield Excel Worksheet Functions 4 December 5th 07 10:00 PM
Carrying a balance forward Melanie Savasta Excel Worksheet Functions 2 April 18th 06 04:07 PM
Carrying formatting automatically to new W/S Jonah Excel Worksheet Functions 4 September 6th 05 12:12 AM
IF is not carrying out the FALSE part derekbrown Excel Worksheet Functions 3 August 23rd 05 11:28 AM


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