#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Increase

Is there a code that will scan every even cell in column F for a quantity and
if it finds a quantity it will add a 1 to the quantity?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Increase

Dim lR As Long
With Sheets("Sheet1")
For lR = 1 To .Cells(.Rows.Count, "F").End(xlUp).Row
If WorksheetFunction.IsNumber(.Cells(lR, "F")) And _
Not .Cells(lR, "F").HasFormula Then
.Cells(lR, "F") = .Cells(lR, "F") + 1
End If
Next
End With


--

Regards,
Nigel




"Workbook" wrote in message
...
Is there a code that will scan every even cell in column F for a quantity
and
if it finds a quantity it will add a 1 to the quantity?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Increase

The OP wanted to add one to only the even rows (he said "even cells", but
that is what I think he meant), so the loop counter should start at 2 and
Step 2 needs to be added to the end of your For statement...

Dim lR As Long
With Sheets("Sheet1")
For lR = 2 To .Cells(.Rows.Count, "F").End(xlUp).Row Step 2
If WorksheetFunction.IsNumber(.Cells(lR, "F")) And _
Not .Cells(lR, "F").HasFormula Then
.Cells(lR, "F") = .Cells(lR, "F") + 1
End If
Next
End With

--
Rick (MVP - Excel)


"Nigel" wrote in message
...
Dim lR As Long
With Sheets("Sheet1")
For lR = 1 To .Cells(.Rows.Count, "F").End(xlUp).Row
If WorksheetFunction.IsNumber(.Cells(lR, "F")) And _
Not .Cells(lR, "F").HasFormula Then
.Cells(lR, "F") = .Cells(lR, "F") + 1
End If
Next
End With


--

Regards,
Nigel




"Workbook" wrote in message
...
Is there a code that will scan every even cell in column F for a quantity
and
if it finds a quantity it will add a 1 to the quantity?



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
Number in cell increase with increase in font size. Value increases with increase in font.[_2_] Excel Discussion (Misc queries) 2 August 9th 07 01:58 PM
HELP - 5% INCREASE sjuncker Excel Worksheet Functions 3 February 12th 06 04:02 AM
percentage increase bigjeffscv Excel Worksheet Functions 1 September 26th 05 11:50 PM
price increase to always end in 9, i.e. 1.99 Frank Excel Discussion (Misc queries) 1 September 22nd 05 09:15 PM
Increase A2 by 15% Kellytwh Excel Discussion (Misc queries) 2 September 2nd 05 05:08 PM


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