BiscuitButter
New Member
- Joined
- Feb 28, 2020
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello,
This is my first time requesting help for any form of coding so I deeply apologize in advance for any faux pas that I'm about to commit.
That being said...
I'm trying to copy certain ranges from one worksheet to another. Reason being, the source sheet contains a bunch of confidential info that my customers aren't supposed to be privy to.
My problem is occurring with my ElseIf argument. I need to select one of two columns based on whether I'm generating a form for Spring/Summer goods or Fall/Winter. When I input 'SS', everything works fine. When I input 'FW', I get a Run-time 1004 error. If I put in anything other than 'FW', I get my "Your an idiot" response.
What did I do wrong?
This is my first time requesting help for any form of coding so I deeply apologize in advance for any faux pas that I'm about to commit.
That being said...
I'm trying to copy certain ranges from one worksheet to another. Reason being, the source sheet contains a bunch of confidential info that my customers aren't supposed to be privy to.
My problem is occurring with my ElseIf argument. I need to select one of two columns based on whether I'm generating a form for Spring/Summer goods or Fall/Winter. When I input 'SS', everything works fine. When I input 'FW', I get a Run-time 1004 error. If I put in anything other than 'FW', I get my "Your an idiot" response.
What did I do wrong?
VBA Code:
Private Sub formulae()
Dim ws_casi As Worksheet
Dim ws_data As Worksheet
Dim LastRow_casi As Long
Dim LastRow_data As Long
Set ws_casi = ThisWorkbook.Worksheets("Cut And Sold Inquiry")
Set ws_data = ThisWorkbook.Worksheets("DATA")
LastRow_casi = ws_casi.Cells.Find("*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row
LastRow_data = ws_data.Cells.Find("*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row
season = UCase(Application.InputBox(prompt:="What Season Is This ATS For?" & vbCrLf & "Enter 'SS' for 'Spring/Summer'" & vbCrLf & "Enter 'FW' for 'Fall/Winter'", Type:=2))
' DATA WS formulas
ws_data.Range("E2:E" & LastRow_data).Formula = "=B2&C2&D2"
ws_data.Range("F2:F" & LastRow_data).Formula = "=IF(LEN(D2)>0,B2&""-""&C2&""-""&D2,IF(LEN(C2)>0,B2&""-""&C2,C2))"
ws_data.Range("J2:J" & LastRow_data).Formula = "=IF(ISNUMBER(RIGHT('Cut And Sold Inquiry'!$O2,1)+0),LEFT('Cut And Sold Inquiry'!$O2,1),'Cut And Sold Inquiry'!$O2)"
ws_data.Range("O2:O" & LastRow_data).Formula = "=RIGHT('Cut And Sold Inquiry'!$U2,LEN('Cut And Sold Inquiry'!$U2)-6)"
If season = "SS" Then
ws_casi.Range("V2:V" & LastRow_casi).Copy Destination:=ThisWorkbook.Worksheets("DATA").Range("P2")
ElseIf season = "FW" Then
ws_casi.Range("W2:2" & LastRow_casi).Copy Destination:=ThisWorkbook.Worksheets("DATA").Range("P2")
Else
MsgBox "I just wanted you to type SS or FW." & vbCrLf & "Was it really that hard?"
End If
End Sub