Wednesday, July 6, 2016

How Can I Fix - alternative condition in VBA?

alternative condition in VBA

I ve write a code in which I want to add a string of text if in a cell if in another cell there is a specific code "2040016643" , and add another string of text if there are others codes "2040016628", "2040016627" ecc...
if there isn t this 2 condition I want to report only the code in column 5
but something go wrong...thanks for your help!
here the code:
Dim i As Integer
    For i = 2 To lastrow
        If Cells(i, 6) = "2040016643" Then
             Cells(i, 1) = Cells(i, 5) & "-UFF.GARE"
             If Cells(i, 6) = "2040016628" Or "2040016627" Or "2040016625" Or "2040016632" Or "2040016626" Or "2040016629" Or "2040016630" Or "2040016631" Then
            Cells(i, 1) = Cells(i, 5) & "CTS"
            Else: Cells(i, 1) = Cells(i, 5)
            End If
        End If
     Next i

Anwsers to the Problem alternative condition in VBA

Download SmartPCFixer for Free Now

Try this version:
    Dim i As Long
    For i = 2 To lastrow
        Select Case Cells(i, 6)
            Case "2040016643"
                Cells(i, 1) = Cells(i, 5) & "-UFF.GARE"
            Case "2040016628", "2040016627", "2040016625", "2040016632", _
                 "2040016626", "2040016629", "2040016630", "2040016631"
                Cells(i, 1) = Cells(i, 5) & "CTS"
            Case Else
                Cells(i, 1) = Cells(i, 5)
        End Select
     Next I

Windows Error Reporting - To Fix alternative condition in VBA

  1. Go to Start button.
  2. Open Control Panel.
  3. Go to Windows Error Reporting.
  4. Click on System and Maintenance, then click Problem Reports and Solutions.
  5. Next, click Change Settings located on the left side panel of the Problem Reports and Solutions window.
  6. Select an option to configure how you want Windows to look for a solution to your problems. You may allow Windows to do it automatically or ask you every time to check if problem occurs.
  7. Next, click the Advanced settings link.
  8. Select Off to turn off Error Reporting.

Recommended Method to Fix the Problem: alternative condition in VBA:

How to Fix alternative condition in VBA with SmartPCFixer?

1. Download SmartPCFixer. Install it on your system.

2. After the scan is finished, you can see the errors and problems need to be fixed. Click Fix All.

3. When the Fixing part is finished, your computer has been speeded up and the errors have been removed

Related: error message fsui.exe/ wlidcli.dll is missing
,Solution to Error: Excel: Automatic number generation
,Troubleshoot:i wanna change language of all windows in Windows 7 Home Premium
,Troubleshooting:IF Function, if the vendor ID in column A matches any of the vendor ID's in column F, I want 1099 to appear in column D. Error
,Fast Solution to Problem: ReadyBoost is not working properly in my computer
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22),brclr.dll.mu_ Missing Error Fixer,How To Resolve Missing fin_myagtui.eng Problem,Corrupted f_0006ad File - How to Fix,nkebigvg.cpl Not Found Error Fixer,Corrupted olcontrols.ocx File - How to Fix
Read More: How Can You Fix - Always my system needs Last Known Good Configuration to reboot?,Troubleshooting:anchoring chart location in excel spread sheet,Troubleshooting:AMD FX CPU and Windows 8,[Solution] Applications won't open unless PC is re-started.,Solution to Error: amilo m3438g sound on windows 7,After Windows Update CD/DVD drive does not work,After installing windows 7 to laptop the labels print out of line how can I fix it,After my computer sleeps the wireless always disconnects and will no reconnect,After signing into, I get a message" This tab has been recovered"....what does this mean and how do I fix it.....,All desktop icons changed to windows live and does not open

No comments:

Post a Comment