LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default There's got to be a better way....

Is there a way to make this code shorter. Either by looping or some other
function?

Sub Make_Up_1()

Range("MU_Card1").FormulaR1C1 = _
"=IF(card1=1,""A""," & _
"if(card1=11,""J""," & _
"if(card1=12,""Q""," & _
"if(card1=13,""K"",card1))))"

' Looks at Card 1 for Number Insertion

If Range("MU_Card1") = "2" Then
Sheets("Shuffle").Visible = True
Sheets("Shuffle").Select
ActiveSheet.Shapes("Two").Select
Selection.Copy
Sheets("Card1_Select").Select
Range("MU_Card1").Select
ActiveSheet.Paste
Range("MU_Card1A").Select
ActiveSheet.Paste
Selection.Name = "Two_A"
Range("MU_Card1,MU_Card1A").Select
Selection.ClearContents
Else
If Range("MU_Card1") = "3" Then
Sheets("Shuffle").Visible = True
Sheets("Shuffle").Select
ActiveSheet.Shapes("Three").Select
Selection.Copy
Sheets("Card1_Select").Select
Range("MU_Card1").Select
ActiveSheet.Paste
Range("MU_Card1A").Select
ActiveSheet.Paste
Selection.Name = "Three_A"
Range("MU_Card1,MU_Card1A").Select
Selection.ClearContents
Else

This code repeats itself 13 times total. It takes up a lot of room in my
macro files. Does anyone have an idea to make this shorter?

Thanks in advance
--
Pete
 
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



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