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: 1
Default using decimal numbers in for-next statement

I'm using a for-next statement for finding values in certain ranges.

When I use whole numbers, there is no problem and everything work
allright. But in one range I need to beable to use decimal numbers, an
suddenly my code seems to contain errors. Here is the working code:

If Not pro1.text = "" Then
fa = pro1.text
fb = pro2.text
For x = fa To fb
For y = 1 To 5
Set c = Range("F2:F2000").Find(fa, ActiveCell, xlValues, _
xlWhole, xlByColumns, xlNext)
If Not c Is Nothing Then
c.Activate
c.Interior.ColorIndex = 7
c.Offset(0, -1).Interior.ColorIndex = 7
c.Offset(0, -2).Interior.ColorIndex = 7
c.Offset(0, -3).Interior.ColorIndex = 7
c.Offset(0, -4).Interior.ColorIndex = 7
c.Offset(0, -5).Interior.ColorIndex = 7
End If
y = y + 1
Next y
fa = fa + 1
Next x
End If

And the code that doesn't work:

If Not ppe1.text = "" Then
ga = ppe1.text
gb = ppe2.text
For x = ga To gb
For y = 1 To 5
Set c = Range("G2:G2000").Find(ga, ActiveCell, xlValues, _
xlWhole, xlByColumns, xlNext)
If Not c Is Nothing Then
c.Activate
c.Interior.ColorIndex = 8
c.Offset(0, -1).Interior.ColorIndex = 8
c.Offset(0, -2).Interior.ColorIndex = 8
c.Offset(0, -3).Interior.ColorIndex = 8
c.Offset(0, -4).Interior.ColorIndex = 8
c.Offset(0, -5).Interior.ColorIndex = 8
c.Offset(0, -6).Interior.ColorIndex = 8
End If
y = y + 1
Next y
ga = ga + 0.01
Next x
End If

As you can clearly see, the only thing I've changed is the interval fo
the next value of x.
I've spend the last three hours coming up with solutions, but nothin
is working.
I'm hoping one of you can see one?!

tnx in advance,
Pee

--
Message posted from http://www.ExcelForum.com

 
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
Decimal Numbers typed into Excel 2003 read as whole numbers john mcmichael Excel Discussion (Misc queries) 1 May 10th 07 08:18 PM
Subtracting two 2-decimal place numbers gives result 13-decimal places? [email protected] Excel Worksheet Functions 5 March 12th 07 10:38 PM
If then statement displaying 2 or 3 decimal places Miles Excel Worksheet Functions 2 February 27th 07 12:44 AM
How can I sort mostly 3 decimal with some 4 decimal numbers PeterM Excel Discussion (Misc queries) 4 August 16th 06 02:15 AM
If Statement - in time not decimal minutes Sue Excel Worksheet Functions 1 March 30th 05 04:35 PM


All times are GMT +1. The time now is 08:46 AM.

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"