Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 'and' criteria

hello,how would i amend the following so as to run if the cell in column is greater than 0 AND the next cell states 'inc'?

If cell 0 The

Please.......???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 'and' criteria

You need to reference the row,column of the cell and the direction of the
next cell, the following assumes cell A1 then A2.

If Cells(1, 1).Value 0 And Cells(2, 1).Text = "inc"

Unless it is the activecell you are testing

If ActiveCell.Value 0 And ActiveCell.Offset(1, 0).Text = "inc"

Cheers
Nigel

"geoffM" wrote in message
...
hello,how would i amend the following so as to run if the cell in column

is greater than 0 AND the next cell states 'inc'??

If cell 0 Then


Please.......????



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 'and' criteria

thanks so much....this is actually my entire code. It may help. Column D is the 1 and column E should read 'inc'

thank

Private Sub CommandButton1_Click(
CopyData Range("D9:D13"), "FEEDER
CopyData Range("D16:D58"), "MACHINE
CopyData Range("D63:D73"), "DELIVERY
CopyData Range("D78:D82"), "PECOM
CopyData Range("D88:D94"), "ROLLERS
CopyData Range("D104:D128"), "MISCELLANEOUS
End Su
Private Sub CopyData(rngD As Range, Target As String
Dim rng As Range, cell As Rang
Dim rng1 As Range, rng2 As Rang
Dim rng3 As Rang
Dim nrow As Long, rw As Lon
Dim Sh As Workshee
nrow = Application.CountIf(rngD, "0"
If nrow = 0 Then Exit Su
Set Sh = Worksheets("Quote2"
Set rng = Sh.Columns(1).Find(What:=Target,
After:=Sh.Range("A1"),
LookIn:=xlValues,
LookAt:=xlPart,
SearchOrder:=xlByRows,
SearchDirection:=xlNext,
MatchCase:=False
Set rng3 = rn
rng.Offset(1, 0).ClearContent
If Application.CountA(rng3) 2 The
Els
Set rng3 = rng.Offset(2, 0
End I
rw = rng3.Ro
rng3.Resize(nrow * 2, 1).EntireRow.Inser
For Each cell In rng
If Not IsEmpty(cell) The
If IsNumeric(cell) The
If cell 0 The
Cells(cell.Row, 1).Resize(1, 2).Copy
Destination:=Sh.Cells(rw, 1
rw = rw +
End I
End I
End I
Nex
End Su


----- Nigel wrote: ----

You need to reference the row,column of the cell and the direction of th
next cell, the following assumes cell A1 then A2

If Cells(1, 1).Value 0 And Cells(2, 1).Text = "inc

Unless it is the activecell you are testin

If ActiveCell.Value 0 And ActiveCell.Offset(1, 0).Text = "inc

Cheer
Nige

"geoffM" wrote in messag
..
hello,how would i amend the following so as to run if the cell in colum

is greater than 0 AND the next cell states 'inc'?
If cell 0 The
Please.......???


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
'COUNTIF' and 'AND' Rajula Excel Discussion (Misc queries) 7 June 21st 06 01:25 PM
'if' and 'and' Lynneth Excel Worksheet Functions 2 February 4th 06 11:42 AM
I think this is either 'IF' or 'And' John Excel Discussion (Misc queries) 0 November 9th 05 05:11 PM
How do I use 'And' or "Or" in an If statment wmurphyjr Excel Worksheet Functions 3 May 4th 05 11:46 AM
'And' / 'Or' statements Apfreight Excel Programming 1 July 29th 03 11:33 PM


All times are GMT +1. The time now is 09:05 AM.

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"