![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com