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: 258
Default Using a variable in a formula

I get a Method Range of object global failed error on the following line
of code:

If Range("C[" & rowtop & "]").Value = Range("A1").Value Then

On that particular line the variable (rowtop) should be 3 since the
ActiveCell.Row is less than 9.


Sub aaaData_Sort()

Dim rowtop As Integer
Dim row1 As Integer
Dim row5 As Integer

If ActiveCell.Row 9 Then
rowtop = 3
row1 = 4
row5 = 8
End If


If Range("C[" & rowtop & "]").Value = Range("A1").Value Then

GoTo Continue1

End If

If Range("C[" & rowtop & "]").Value "" Then

Range("A[" & row1 & "]:C[" & row2 & "]").Select
Selection.Sort Key1:=Range("A[" & row1 & "]"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End If

Continue1:


 
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
Variable within a formula Tom Melosi Excel Worksheet Functions 4 August 21st 07 04:07 AM
Using a variable in a formula [email protected] Excel Discussion (Misc queries) 1 December 29th 06 11:46 AM
Using a variable in a VBA formula Colin Vicary Excel Discussion (Misc queries) 3 November 8th 05 11:39 AM
Using a variable in formula DtTall Excel Programming 2 August 15th 05 04:23 PM
Formula Variable Ronbo Excel Programming 3 March 4th 04 09:33 PM


All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"