crazyeyeschase
Board Regular
- Joined
- May 6, 2014
- Messages
- 104
- Office Version
- 365
- Platform
- Windows
This is a macro that i am working on for Minecraft yeah i'm a nerdy gamer however i might be using this macro or one similar to it for quite a few other things and i have noticed it is quite long.
What is does is pretty much looks for a picture in a worksheet that has the same name as a cell value in a cell (drop down list). It them copies the image accordingly. I was wondering if their might be any way to instead of having so many if statements making the cell name like a variable i dont know and this might be as simple as i can get it but just wanted to check.
What is does is pretty much looks for a picture in a worksheet that has the same name as a cell value in a cell (drop down list). It them copies the image accordingly. I was wondering if their might be any way to instead of having so many if statements making the cell name like a variable i dont know and this might be as simple as i can get it but just wanted to check.
Code:
Sub BannerWool()
Dim FC As Range
Dim BannerRng As Range
Dim CellRange As String
Dim r As Long
Dim c As Long
r = 4
c = 3
Dim shape As shape
With Sheets("Banners")
Set FC = .Range("E4")
End With
With Sheets("Sheet1")
Set BannerRng = .Range("C4,C6,E4,E6,G4,G6")
End With
With Sheets("Pictures").Activate
If FC.Text = "White" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Orange" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Orange Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Magenta" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Magenta Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Light Blue" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Light Blue Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Yellow" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Yellow Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Lime" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Lime Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Pink" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Pink Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Gray" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Gray Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Light Gray" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Light Gray Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Cyan" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Cyan Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Purple" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Purple Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Blue" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Blue Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Brown" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Brown Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Green" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Green Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Red" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Red Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
Else
If FC.Text = "Black" Then
For Each Cell In BannerRng
Sheets("Pictures").Shapes.Range(Array("Black Wool")).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(r, c).Select
ActiveSheet.Paste
If r = 4 Then
r = r + 2
Else
r = 4
c = c + 2
End If
Next Cell
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End With
End Sub