Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Getting the correct reference cell to work | Excel Discussion (Misc queries) | |||
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? | Excel Programming | |||
I'm desperate I posted earlier about "If" statements that don't work but are correct. Now... | Excel Worksheet Functions | |||
I want to correct a #div/0! error but the IF function doesnt work | Excel Worksheet Functions | |||
Correct formulas in cells, have to retype to work | Excel Discussion (Misc queries) |