Help me with IF Statement

bhandari

Active Member
Joined
Oct 17, 2017
Messages
359
i want to add IF condition in my macro.This condition need to merge in my code
if E5= Random Value
E6=Data List Validation (INPUT 1,INPUT 2,INPUT 3,INPUT 4)
if E6=INPUT 1
ElseIf
E6=INPUT 2
ElseIf
E6=INPUT 3
ElseIf
E6=INPUT 4
(CODE IS SAME ONLY FORMULAS ARE CHANGING IF INPUT 1 THEN THIS FORMULAS.ITS DEPEND UPON E6 CELL INPUT) i will add my formulas for it)
I have Given my if condition code is working fine but i need to add above condition in my macro:)
Code:
 If Len(.Cells(5, X).Value) > 0 Then
                On Error Resume Next
                Set wks = Sheets(CStr(.Cells(5, X).Value))
                On Error GoTo 0
                If wks Is Nothing Then
                    Sheets("INPUT 1").Visible = True
                    Sheets("Shapes").Visible = True
                    Sheets("INPUT 1").Copy after:=Sheets(Sheets.Count)
                    Sheets(Sheets.Count).Name = .Cells(5, X).Value
                    Set wks = ActiveSheet
                     MyFormulas = Array("='" & wks.Name & "'!$BB$105", "", "", "",  "='" & wks.Name & "'!$BB$109", "", "", "", "='" & wks.Name  & "'!$BB$124", "='" & wks.Name & "'!$BB$143", "", "", "",  "", "", "='" & wks.Name & "'!$BB$115+'" & wks.Name &  "'!$BB$116", "", "='" & wks.Name & "'!$BB$211", "", "", "", "",  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",  "", "", "", "", "", "", "", "", "", "='" & wks.Name &  "'!$BB$151", "", "='" & wks.Name & "'!$BB$157", "", "", "", "",  "", "", "", "='" & wks.Name & "'!$BB$167", "", "='" &  wks.Name & "'!$BB$169", "='" & wks.Name & "'!$BB$168", "='"  & wks.Name & "'!$BB$160", "", "", "='" & wks.Name &  "'!$BB$183", "='" & wks.Name & "'!$BB$193", "", "", "='" &  wks.Name & "'!$BB$187", "", "", "", "", "='" & wks.Name &  "'!$BB$192", "", "", "", "='" & wks.Name & "'!$BB$158", "='"  & wks.Name & "'!$BB$159", "='" & wks.Name & "'!$BB$200",  "='" & wks.Name & "'!$BB$195", "", "", "", "='" & wks.Name  & "'!$BB$203", "", "", "", "", "" _
                    &  "='" & wks.Name & "'!$BB$196", "", "", "", "='" & wks.Name  & "'!$BB$199", "", "", "", "", "", "", "", "", "", "", "", "", "",  "", "", "", "", "", "", "", "", "", "='" & wks.Name &  "'!$BB$212*25", "='", "='")
                    .Range("A10").Offset(, X - 1).Resize(119, 1).Formula = Application.Transpose(MyFormulas)
                    ThisWorkbook.Worksheets("Abstract").Range("E130:AH130").Clear
                Else
                     MsgBox "Sheets: " & .Cells(5, X).Value & vbCrLf & vbCrLf  & "Already exists!", vbExclamation, "Sheet Exists"
                End If
            End If
 
Last edited:
I do not have the ability to "assign" problems to anyone. This is an all volunteer board. People are free to answer (or not) any questions they want.

If you are looking for Consulting Service, please see the "Excel Consulting Services" link in the menu bar: https://www.mrexcel.com/consulting-services/
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Cross posted https://www.excelforum.com/excel-pr...am-looking-for-help-with-my-project-task.html

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top