Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Code problem

On my spreadsheet C3 contains a formula which returns the number 1 and cell
W1 value is 1, in this case the code should skip to Continue1: and not sort
the cells, but it is not. Can anyone tell me why?

If Range("C3").Value = Range("W1").Value Then

GoTo Continue1

End If

If Range("C3").Value "" Then

Range("A4:C8").Select
Selection.Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End If

Continue1:


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code problem

Are you sure that C3 is exactly 1, it doesn't have some very small
fractional part. Try increasing the decimal places to see.

If so, and dealing with integers, you could use

If Int(Range("C3").Value) = Int(Range("W1").Value) Then

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Patrick Simonds" wrote in message
...
On my spreadsheet C3 contains a formula which returns the number 1 and

cell
W1 value is 1, in this case the code should skip to Continue1: and not

sort
the cells, but it is not. Can anyone tell me why?

If Range("C3").Value = Range("W1").Value Then

GoTo Continue1

End If

If Range("C3").Value "" Then

Range("A4:C8").Select
Selection.Sort Key1:=Range("A4"), Order1:=xlAscending,

Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End If

Continue1:




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
Problem with code kk Excel Discussion (Misc queries) 0 March 15th 08 03:01 PM
CODE PROBLEM N.F[_2_] Excel Discussion (Misc queries) 2 June 15th 07 08:07 PM
Problem with Code Below Ben H Excel Programming 7 February 25th 05 08:30 PM
Problem with the following code Vince Excel Programming 3 November 19th 04 08:51 AM
VBA code problem excelnoob[_2_] Excel Programming 1 July 5th 04 01:31 PM


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