Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Select Case syntax

I have entered the following where if cell K17 = United Kingdom and
if cell K16 = USD then cell B75 = cell U13 . . . .
However when I run it the debug window pops up.
Is this due to the syntax being incorrect?

Select Case Range("K17").Value
Case "United Kingdom":
If Range("K16").Value = "USD" Then
Cells("B75").Value = Cells("U13").Value
ElseIf Cells("K16").Value = "CAD" Then
Cells("B75").Value = Cells("S13").Value
End If
Case Else:
Cells(75, "B") = ""
End Select

Thank you in advance Susan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Select Case syntax

Hi Susan,

Try changing each instance of Cells to Range.

The correct syntax for cells is:

Cells(RowNo, ColNo) or Cells(RowNo, "ColLetter")

---
Regards,
Norman



"Susan Hayes" wrote in message
...
I have entered the following where if cell K17 = United Kingdom and
if cell K16 = USD then cell B75 = cell U13 . . . .
However when I run it the debug window pops up.
Is this due to the syntax being incorrect?

Select Case Range("K17").Value
Case "United Kingdom":
If Range("K16").Value = "USD" Then
Cells("B75").Value = Cells("U13").Value
ElseIf Cells("K16").Value = "CAD" Then
Cells("B75").Value = Cells("S13").Value
End If
Case Else:
Cells(75, "B") = ""
End Select

Thank you in advance Susan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Select Case syntax

Yes, Cells takes a row and a column as separate arguments, not an address

Select Case Range("K17").Value
Case "United Kingdom":
If Range("K16").Value = "USD" Then
Range("B75").Value = Range("U13").Value
ElseIf Range("K16").Value = "CAD" Then
Range("B75").Value = Range("S13").Value
End If
Case Else:
Range("B75").Value= ""
End Select


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Susan Hayes" wrote in message
...
I have entered the following where if cell K17 = United Kingdom and
if cell K16 = USD then cell B75 = cell U13 . . . .
However when I run it the debug window pops up.
Is this due to the syntax being incorrect?

Select Case Range("K17").Value
Case "United Kingdom":
If Range("K16").Value = "USD" Then
Cells("B75").Value = Cells("U13").Value
ElseIf Cells("K16").Value = "CAD" Then
Cells("B75").Value = Cells("S13").Value
End If
Case Else:
Cells(75, "B") = ""
End Select

Thank you in advance Susan



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
Select Case ignored Preschool Mike Excel Worksheet Functions 4 September 9th 09 08:12 PM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
VB Syntax to select a range xjetjockey Excel Discussion (Misc queries) 4 January 17th 07 03:12 AM
Range.Select Using Variables - need syntax gradientS Excel Discussion (Misc queries) 3 February 16th 05 12:45 PM
Select Case Susan Hayes Excel Programming 1 November 4th 04 08:37 PM


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