case statement

  1. J

    Case statement using nested ifs

    Hey All! I am running into an issue I can't figure out. I've got a big set of data and there is a specific column that I want to make a case statement based on the results. If the field, lets call it A1, is... =42 or =43 or is between 70 - 99, excluding 79 and 81 then I want to call it "Yes"...
  2. Johnny Thunder

    VBA Help - If Cell Contains Partial String Then.......

    Hello all, Have a question that I thought I could easily answer but for whatever reason it doesn't seem to be working so another pair of eyes may help. I have a For Each Cell in Range Statement that looks at a Doc Type (2 Digit Variable) and when it finds "KR" to Search a Offset Cell for...
  3. S

    Multiple case statements VBA

    I need to search column E for specific values and if that row has them then it will not delete the row The problem is that I need to search it based on if it starts with something. So in the example below if cell E98 started with "AG____ " then that row would not be deleted Dim iLastRow As...
  4. Johnny Thunder

    VBA Help - Select Case with Greater than or Less than Statement

    Hi Guys, Working on a piece of code and not getting the desired results. My code is looking in column C for a specific cell with text and giving me a row number, I am using the row number to dynamically set how many pages to make the worksheet print too (i.e small amount of data print to 1...
  5. C

    Case Statement for Multiple Checkboxes Hiding/Unhiding Columns

    Hi! :) I'm new to VBA and need some help changing this to a case statement. Thank you for your help!!! Cheryl If ActiveSheet.Shapes("Check Box 110").ControlFormat.Value = 1 Then Sheets("DHMO Copay").Columns("C").EntireColumn.Hidden = False Else: Sheets("DHMO...
  6. R

    Hiding/Showing Columns Based on Drop-Down List - VBA

    Hi All, I have been struggling to get this working. I am trying to hide columns (C thru AA is the range) based on the value selected from the drop down in cell A12. The values are something like "Show All Details", "Show Financials", "Show KPI Results".... etc. For Example, i want to hide...
  7. T

    Select Case - Named Ranges

    I have a spreadsheet that contains currency name in col A e.g. USD, AUD etc. Col B contains the amount that needs to be converted into GBP. The calculations will happen in the VBA code below and results stored in col C, D and E</SPAN> Sub SoSo()</SPAN></SPAN> Dim Rng As Range</SPAN></SPAN> Dim...
  8. E

    Case or If statement

    I have the following code to change a cell's color based on certain conditions. I am comparing the values of two cells on the same worksheet. I have tried this with If Else If, seperate If statements and Case statements but cannot get it to work. Any clues would be appreciated and Happy...
  9. N

    How do I speed up a CASE statement that loops through a large data set?

    Hi there I have a CASE statement that is looping through a very large data set (>75,000 rows) and if the state says "New South Wales" i need it changed to NSW. I need this abbreviation for all Australian states. My code works but it is taking FOREVER to loop through all the data. Can i convert...
  10. J

    Copy-Pasting Dynamically Using Case Statements And Named Ranges

    I want to do a simple copy and paste from one tab of my workbook to another. I created 24 named ranges (not efficient I know), 12 for the copies and 12 for the pastes, again all a part of 12 cases. The copy is somewhat static, it will always be one row of cells, the reason I have it to be...
  11. F

    Case with like

    hi, I have macro where I'm opening workbooks and for diffrent sheets I want to run code. ... Set wb = Workbooks.Open(strPath2 & strFile2) Dim myArray() As String Dim myCount, NumShts As Integer NumShts = wb.Worksheets.Count ReDim myArray(1 To NumShts) For myCount = 1...
  12. K

    VBA help! Function Case Statement and multi conditions for cell coloring

    Ok - I admit - I am adding two questions into one thread.:eeek: First scenario: In column G - I have different phases. I need to calucate how many dates it's been in that phase. It's an easy formula =networkdays(O2,Today(), Holidays A1:A10). O2 is the day that it moved into that phase...
  13. LostInTheTrees

    Combining Conditionally Visible Worksheets with Case Statement in VBA

    Hi! I'm using Excel 2010 (Windows 7) to develop a workbook with the goal of tying conditionally visible worksheets to a case statement. Conceptually, I want a user to enter a password and click on the enter password button, and have the sheets they are authorized to see appear in the tabs...
  14. Z

    How should I tackle this problem?

    Hey so I just wanted to see what the opinions are on how I should tackle the probelm I am trying to solve. Below is what my table looks like and I need to paste in a number to its corripsonding cell. The program should find out what the crop is (found on another worksheet) and then find out...
  15. C

    Select Case Statement in For Each Loop

    Hi there, will do my best to be brief: I have the code below to loop through cells in column A and then place a result into column B based upon the value in column A. I also want the value of the cell to be put to Upper Case only for the purposes of comparison, i.e. I do not need it changed in...
  16. Gingertrees

    custom function to search for multiple instr?

    I'm trying to write a function to test if a cell contains a website. So far I've got: Function IsURL(text) Dim test As Variant Dim eml As Variant eml = InStr(text, "@") 'if not present, position = 0 test = InStr(text, ".com") If eml > 1 Then IsURL = "email" ElseIf test > 4 Then IsURL =...
  17. JackDanIce

    Case Statement with Wild Cards

    Hi, I'm trying to delete sheets that have specific names or similar (e.g. delete "Sheet1" and "Sheet1 (2)") I am using the following code: For Each ws In Worksheets Select Case ws.Name Case "Remaining*", _ "No_Break*", _ "Listed_Instruments*", _...
  18. Maverick99

    To Call a Sub from a Case Statement

    I have run across some code that uses Case Statements, based upon a user's Button Selection from a UserForm. This is located in the UserForm Event Module. I thought this would be straight forward to have it call a Sub "WriteToLog," if the Case Statement is true. However, it's not working for...
  19. G

    Simple Code to open multiple hidden worksheets

    Hello, Very new to VBA. Working off a code that hides worksheets until a password given to open them. I want to modify this so that it will open more than one sheet... What I have: Option Compare Text Const pWord2 = "XXX" Sub showsheets2() Select Case InputBox("Enter Raw Data...
  20. R

    Case Statement Usage

    Please help me code the proper method to using a Case Statement. Here's what I have coded: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) '---------------------------------------------- ' Test where the double click occurred...

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
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 "".
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