Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default rng no work correct...

Why in this part of code in the first CEL have "FIL." and not the
first cell in filter????
In this case 4500 when SOMMA is =0 ????
(start Sub SPOSTA_LINEE_ZERO())

If SOMMA = 0 Then
For Each CEL In RNG1
RIGA = CEL.Row
If CEL = SPORTELLO And Range("D" & RIGA).Value = SOSPESO Then
WS.Range("AA" & RIGA) = "ZERO"
WS.Range("AA1") = WS.Range("AA1") + 1
End If
Next CEL

here the file:
http://www.mytempdir.com/1247401

  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default rng no work correct...

Hi Sal21-

In your orignal code, the object RNG1 refers to a range that includes the
header row cell ("FIL.") as its 'first' value. Therefore, the value "FIL."
is assigned to CEL in the the first iteration of the statement "For each CEL
in RNG1".

One way to start assignments to CEL that begin with data (instead of the
header field "FIL."), would be to resize the range RNG1 before the
For...Each statement. Here is a suggested modification to do that:

1. Delete (or comment out) the following statements in:
With WS.AutoFilter.Range
Set RNG1 = .Columns(12).SpecialCells(xlCellTypeVisible)
FROWS = RNG1.Count
End With

2. And replace them with the following 4 statements at the same location:
Set RNG1 = RNG1.Columns(12).Cells
Set RNG1 = RNG1.Offset(1, 0).Resize(RNG1.Cells.Count - 1, 1)
Set RNG1 = RNG1.SpecialCells(xlCellTypeVisible).Cells
FROWS = WorksheetFunction.CountA(RNG1)

--
Jay


"sal21" wrote:

Why in this part of code in the first CEL have "FIL." and not the
first cell in filter????
In this case 4500 when SOMMA is =0 ????
(start Sub SPOSTA_LINEE_ZERO())

If SOMMA = 0 Then
For Each CEL In RNG1
RIGA = CEL.Row
If CEL = SPORTELLO And Range("D" & RIGA).Value = SOSPESO Then
WS.Range("AA" & RIGA) = "ZERO"
WS.Range("AA1") = WS.Range("AA1") + 1
End If
Next CEL

here the file:
http://www.mytempdir.com/1247401


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default rng no work correct...

Jay work perfect!
Tks.

On 10 Mar, 14:57, Jay wrote:
Hi Sal21-

In your orignal code, the object RNG1 refers to a range that includes the
header row cell ("FIL.") as its 'first' value. Therefore, the value "FIL."
is assigned to CEL in the the first iteration of the statement "For each CEL
in RNG1".

One way to start assignments to CEL that begin with data (instead of the
header field "FIL."), would be to resize the range RNG1 before the
For...Each statement. Here is a suggested modification to do that:

1. Delete (or comment out) the following statements in:
With WS.AutoFilter.Range
Set RNG1 = .Columns(12).SpecialCells(xlCellTypeVisible)
FROWS = RNG1.Count
End With

2. And replace them with the following 4 statements at the same location:
Set RNG1 = RNG1.Columns(12).Cells
Set RNG1 = RNG1.Offset(1, 0).Resize(RNG1.Cells.Count - 1, 1)
Set RNG1 = RNG1.SpecialCells(xlCellTypeVisible).Cells
FROWS = WorksheetFunction.CountA(RNG1)

--
Jay



"sal21" wrote:
Why in this part of code in the first CEL have "FIL." and not the
first cell in filter????
In this case 4500 when SOMMA is =0 ????
(start Sub SPOSTA_LINEE_ZERO())


If SOMMA = 0 Then
For Each CEL In RNG1
RIGA = CEL.Row
If CEL = SPORTELLO And Range("D" & RIGA).Value = SOSPESO Then
WS.Range("AA" & RIGA) = "ZERO"
WS.Range("AA1") = WS.Range("AA1") + 1
End If
Next CEL


here the file:
http://www.mytempdir.com/1247401- Nascondi testo tra virgolette -


- Mostra testo tra virgolette -



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
Getting the correct reference cell to work Derek Excel Discussion (Misc queries) 5 June 2nd 08 06:52 PM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
I'm desperate I posted earlier about "If" statements that don't work but are correct. Now... Marc Excel Worksheet Functions 2 April 5th 06 09:27 PM
I want to correct a #div/0! error but the IF function doesnt work Traceyb Excel Worksheet Functions 1 July 21st 05 03:47 PM
Correct formulas in cells, have to retype to work budsb1 Excel Discussion (Misc queries) 3 March 5th 05 11:45 AM


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