Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select Case ignored | Excel Worksheet Functions | |||
Case without Select Case error problem | Excel Discussion (Misc queries) | |||
VB Syntax to select a range | Excel Discussion (Misc queries) | |||
Range.Select Using Variables - need syntax | Excel Discussion (Misc queries) | |||
Select Case | Excel Programming |