Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Need Syntax for "AND" to Evaluate 2 Cells

I need to evaluate 2 cells while inside an "Private Sub
Worksheet_SelectionChange(ByVal Target As Range)". I thought AND would work
but I cannot get it to work; I receive a syntax error on the AND(Range...
line.

Can someone please provide me the proper syntax to evaluate the 2 cells?

Here's my code...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" Then
And(Range("I3") < "", Range("K4") = "") Then
Range("K4") = Range("K3")
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Need Syntax for "AND" to Evaluate 2 Cells

hi
not sure but i thing you are after this.....
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" And _
Range("D1") = "" And _
Range("K1") = "" Then
Range("K4") = Range("K3")
End If
End Sub


regards
FSt1


"GEdwards" wrote:

I need to evaluate 2 cells while inside an "Private Sub
Worksheet_SelectionChange(ByVal Target As Range)". I thought AND would work
but I cannot get it to work; I receive a syntax error on the AND(Range...
line.

Can someone please provide me the proper syntax to evaluate the 2 cells?

Here's my code...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" Then
And(Range("I3") < "", Range("K4") = "") Then
Range("K4") = Range("K3")
End If
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 464
Default Need Syntax for "AND" to Evaluate 2 Cells

No need to check the Sheet name as the code resides Sheet Module;

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("I3") < "" And Range("K4") = "" Then
Range("K4") = Range("K3")
End If
End Sub

I also can helping thinking a simple IF Function in K4 will achieve the
same.



--
Regards
Dave Hawley
www.ozgrid.com
"GEdwards" wrote in message
...
I need to evaluate 2 cells while inside an "Private Sub
Worksheet_SelectionChange(ByVal Target As Range)". I thought AND would
work
but I cannot get it to work; I receive a syntax error on the AND(Range...
line.

Can someone please provide me the proper syntax to evaluate the 2 cells?

Here's my code...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" Then
And(Range("I3") < "", Range("K4") = "") Then
Range("K4") = Range("K3")
End If
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Need Syntax for "AND" to Evaluate 2 Cells

Thanks FSt1 this works great.

"FSt1" wrote:

hi
not sure but i thing you are after this.....
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" And _
Range("D1") = "" And _
Range("K1") = "" Then
Range("K4") = Range("K3")
End If
End Sub


regards
FSt1


"GEdwards" wrote:

I need to evaluate 2 cells while inside an "Private Sub
Worksheet_SelectionChange(ByVal Target As Range)". I thought AND would work
but I cannot get it to work; I receive a syntax error on the AND(Range...
line.

Can someone please provide me the proper syntax to evaluate the 2 cells?

Here's my code...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" Then
And(Range("I3") < "", Range("K4") = "") Then
Range("K4") = Range("K3")
End If
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Need Syntax for "AND" to Evaluate 2 Cells

Dave,
Thanks for the info to NOT check the sheet name.

"ozgrid.com" wrote:

No need to check the Sheet name as the code resides Sheet Module;

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("I3") < "" And Range("K4") = "" Then
Range("K4") = Range("K3")
End If
End Sub

I also can helping thinking a simple IF Function in K4 will achieve the
same.



--
Regards
Dave Hawley
www.ozgrid.com
"GEdwards" wrote in message
...
I need to evaluate 2 cells while inside an "Private Sub
Worksheet_SelectionChange(ByVal Target As Range)". I thought AND would
work
but I cannot get it to work; I receive a syntax error on the AND(Range...
line.

Can someone please provide me the proper syntax to evaluate the 2 cells?

Here's my code...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveSheet.Name = "Sheet1" Then
And(Range("I3") < "", Range("K4") = "") Then
Range("K4") = Range("K3")
End If
End Sub


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
correct syntax for nesting "if", "and", and "vlookup"....if possib Christine Excel Worksheet Functions 4 January 2nd 09 10:43 PM
syntax for "IF" commend to check for multiple empty cells bf comma Chris Excel Worksheet Functions 4 September 3rd 07 12:02 PM
=EVALUATE("{ to work in a range of cells Fin Fang Foom Excel Worksheet Functions 8 May 9th 07 11:33 PM
Syntax to "OR" 3 "ISERROR" conditions Mike K Excel Worksheet Functions 6 July 22nd 06 04:18 PM
what is syntax for if(between range of dates,"Q1","Q2")? TLB Excel Worksheet Functions 3 December 6th 05 05:19 PM


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