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

Can someone provide me assistance with this case statement. I have attached
it to a command button and it does nothing. The object is to copy
information from another sheet in the workbook based on the value of a
certain cell.

Sub GetGrades_Sh1()

Dim sGrade1 As String

sGrade1 = "Shift1!P101"

Select Case sGrade1
Case Is = "WF"
Sheets("Data").Range("B6:B17").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
Case Is = "PP"
Sheets("Data").Range("C6:C22").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
Case Is = "SP"
Sheets("Data").Range("D6:D16").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
End Select
End Sub
--
-----
Thank you,
Liz

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Case Statement Question

You are not comparing to the cell, you are comparing to the string
"Shift1!P101" which is not really what you are looking for. Try this...

Sub GetGrades_Sh1()

Select Case Sheets("Shift1").Range("P101").Value
Case "WF"
Sheets("Data").Range("B6:B17").Copy _
Sheets("Shift1").Range("A7")
Application.CutCopyMode = False
Case "PP"
Sheets("Data").Range("C6:C22").Copy _
Sheets("Shift1").Range("A7")
Application.CutCopyMode = False
Case "SP"
Sheets("Data").Range("D6:D16").Copy _
Sheets("Shift1").Range("A7")
Application.CutCopyMode = False
End Select
End Sub

--
HTH...

Jim Thomlinson


"Liz Steffen" wrote:

Can someone provide me assistance with this case statement. I have attached
it to a command button and it does nothing. The object is to copy
information from another sheet in the workbook based on the value of a
certain cell.

Sub GetGrades_Sh1()

Dim sGrade1 As String

sGrade1 = "Shift1!P101"

Select Case sGrade1
Case Is = "WF"
Sheets("Data").Range("B6:B17").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
Case Is = "PP"
Sheets("Data").Range("C6:C22").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
Case Is = "SP"
Sheets("Data").Range("D6:D16").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
End Select
End Sub
--
-----
Thank you,
Liz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Case Statement Question

Works like a charm.

Thank you so much!
--
-----
Thank you,
Liz



"Jim Thomlinson" wrote:

You are not comparing to the cell, you are comparing to the string
"Shift1!P101" which is not really what you are looking for. Try this...

Sub GetGrades_Sh1()

Select Case Sheets("Shift1").Range("P101").Value
Case "WF"
Sheets("Data").Range("B6:B17").Copy _
Sheets("Shift1").Range("A7")
Application.CutCopyMode = False
Case "PP"
Sheets("Data").Range("C6:C22").Copy _
Sheets("Shift1").Range("A7")
Application.CutCopyMode = False
Case "SP"
Sheets("Data").Range("D6:D16").Copy _
Sheets("Shift1").Range("A7")
Application.CutCopyMode = False
End Select
End Sub

--
HTH...

Jim Thomlinson


"Liz Steffen" wrote:

Can someone provide me assistance with this case statement. I have attached
it to a command button and it does nothing. The object is to copy
information from another sheet in the workbook based on the value of a
certain cell.

Sub GetGrades_Sh1()

Dim sGrade1 As String

sGrade1 = "Shift1!P101"

Select Case sGrade1
Case Is = "WF"
Sheets("Data").Range("B6:B17").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
Case Is = "PP"
Sheets("Data").Range("C6:C22").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
Case Is = "SP"
Sheets("Data").Range("D6:D16").Select
Selection.Copy
Sheets("Shift1").Range("A7").Select
Selection.Paste
Application.CutCopyMode = False
End Select
End Sub
--
-----
Thank you,
Liz

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
Case Statement jlclyde Excel Discussion (Misc queries) 3 December 4th 08 05:04 PM
Case Of Statement hfazal Excel Programming 2 February 14th 06 08:18 PM
select case statement jrd269[_4_] Excel Programming 4 June 3rd 05 04:22 PM
Case Statement Help stck2mlon Excel Programming 3 June 2nd 04 01:44 PM
Case statement smi Excel Programming 2 October 18th 03 02:20 PM


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