Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all 49975 articles
Browse latest View live

Split data into rows

$
0
0
I need a macro that will split data into rows if more than one line exist in the row and when it runs into this it need to insert a new line before splitting it a part so not to write over info that is below it.

Sample.xlsx

Thank you for your help

Copy active workbook to and save new workbook Macro

$
0
0
I am trying to have my team click a button and have the active sheet copy to a new workbook and then save it based on the value of a specific cell. The issue I am running into is that it saves the original file and then copy's the workbook. I wont it to do the opposite. Here is the Formula I currently have.

Code:

Sub Saveworksheet()
'
' Saveworksheet Macro
'  ActiveSheet.Select
    Dim FName As String
    Dim FPath As String
       
    FPath = "E:"
    FName = ActiveSheet.Range("K3").Text
   
    Sheet1.Copy
ThisWorkbook.SaveAs Filename:=FPath & "\" & FName
End Sub

Display progress in Application.StatusBar

$
0
0
I've found a lot to this in many places but nothing really comprehensive and thus have made an effort to implement a common solution in a class module called clsMSBPrgrs which can be found in the Workbook ASBPrgrs.xlsm. It is able to display the progress of any number of sequentially called or nested processes (usually loops of any kind), either together with a variable that illustrates the progress or, if there is none sensible variable, to automatically display dots instead.
Calling the progress display is just one statement like:
Code:

cMSBPrgrs.Dsply "MyProcess", i
wherby i may be the loop iterator. The .Dsply method of the class ensures the update of the Application.StatusBar even for very long processes with thousands of iterations. The class has several properties to "configure" the progress display before it is used the first time which looks as follows:
Code:

    With cASBPrgrs
        .MainProcess = "xxxxx"  ' Names the main process of which the progress is displayed
        .MaxMsgLen = 150        ' Limits the lenght of the message which is adjusted intelligently when exeeded
        .SubProcessesMax = 5    ' Limits the number of displayed sub-processes by dropping olders
        .MsecToNextDsply = 200  ' Avoids a possible performance loss caused by DoEvents, which is used to ensure a frequent message update
    End With

If this sounds interesting I would be happy for any reply regarding its usefullness (once it has been tried of course). In case any help for using/integrating it in your project, please let me know.
P.S.: The Workbook also features a performance test and demo.

Merging all outputs into one message box

$
0
0
Hi all, it's been a while since I used this forum but it's that time again where head scratching doesn't help me progress any more.

I've made a simple excel file that has a list of classes, and whether or not a homework is due in. What I wanted to do is create a file that, upon opening, displays a message saying which classes have a homework due in on that day (or whether it's overdue for whatever reason).

Initially, my code was the following:




Code:

Sub Workbook_Open()

For Each cell In Sheets("HW").Range("H2:H9")
        If cell.Value = "YES" And cell.Offset(0, -2).Value = "No" Then
            MsgBox cell.Offset(0, -7).Value & " HW is due in today"
           
        ElseIf cell.Value = "OVERDUE" Then
            MsgBox cell.Offset(0, -7).Value & " HW is OVERDUE"
           
        End If
    Next

End Sub


What is going on here is that the macro checks to see if there is a "yes", "no" or "overdue" in the "is it due today" column in my worksheet, and then brings up the corresponding class name with the required text.

However, although it works, it gives me individual message boxes for each message. Is there a simple way of merging all outcomes into one message box? I tried assigning variables and having each iteration output the outcome into that variable, with the final message box being composed of all the required variables...however...that leads to the problem of having an unknown number of variables at the start, because I can't predict how many variables the macro should assign at the start. Or am I thinking about it the wrong way? One other suggestion is that to have the maximum number of variables assigned (as many classes as I teach, if ever the day comes where they all need to hand homework in haha!), and simply have no outcome assigned to a variable if there isn't any corresponding homework due in?

Thanks in advance

Replacement occurences in arrays instead of depending on sheet

$
0
0
Hello everyone
I have the following code that do the replacement job depending on two columns in Sheets("Con")
For example in sheets("Con") :
A ---------B
Yaser -----Yasser
Fawezy -----Fawzy
Radaa------Reda
Hallo ---- Hello
Testy-----Test
and so on (about 500 hundred instances)

Is there an easy way to store these instances in an array and depend on it instead of using the sheet ...?

So I need first to store the 500 hundred instances in an array ...how to store them fast (I will delete the Con sheet after that and depend on the arrays>>>)

Second how to do the job of replacement using arrays not sheets?
Hope it is clear
Thanks advanced

Mac throwing error - Runtime Error 429 - ActiveX Component Can't Create Object

$
0
0
Respected Experts,

I am not able to run the following Macro in Excel in Mac computer. I am getting Runtime Error 429 - ActiveX Component Can't Create Object and it is on code
Set Dict = CreateObject("Scripting.Dictionary").

Kindly help me tweak the code as per the Mac capabilities.

Code:

Sub UpdatecampaignId()
   
    Dim DR As Long
    Dim Cell As Range
    Dim Dict As Object
    Dim Key As String
    Dim Item As Variant
    Dim rng  As Range
    Dim Wks As Worksheet
   
    Set rng = Rows(1).Find("campaignId")
    If Not rng Is Nothing Then
            DR = rng.Column
   
      Set Dict = CreateObject("Scripting.Dictionary")
        Dict.CompareMode = vbTextCompare
       
        Set Wks = Worksheets("campaignId")
       
        Set rng = Wks.Range("A1").CurrentRegion
        Set rng = Intersect(rng, rng.Offset(1, 0))
       
        For Each Cell In rng.Columns(1).Cells
            Key = Trim(Cell)
            Item = Cell.Offset(0, 1)
            If Key <> "" Then
                If Not Dict.exists(Key) Then Dict.Add Key, Item
            End If
        Next Cell
       
        Set Wks = Worksheets("Copied Sheet")
       
        Set rng = Wks.Range("A1").CurrentRegion
        Set rng = Intersect(rng, rng.Offset(1, 0).Columns(DR))
       
        For Each Cell In rng
            Key = Trim(Cell)
            If Dict.exists(Key) Then Cell = Dict(Key): Cell.Interior.ColorIndex = 6
        Next Cell
        End If
End Sub

VBA - Use Cell as search criteria for Find All

$
0
0
Hello,

I'm new to VBA and everything I've compiled so far is from help with other Excel forum members and online Searches. I'm working on creating a Cypher in which I could use to communicate with those who have a matching Cypher key using Excel. Part of the set up process (in order for more efficient running of the cypher on a slower computer) is to run a search and paste all those search results into a column and the next results into the next column and so on and so forth. The code I have posted works so far but I need to be able to use the cells in the first row as my search criteria in order to connect the circle and have Excel automatically finish populating the search results.

I have included the file with the original code. Go to the Srch Tab, Click Find All Button, and type in a letter. Excel will do all the work and all you have to do is go to the Srch Tab and pick another letter (one that corresponds to the next column.

This code, instead of continuing with the 2nd Row, it ends on the first row of the column with the next search criteria I want to use. How do I get VBA to search for that particular cell it lands on and how do I get it to stop when it lands on a blank cell?

Thanks in advance for your help.

~MsBBS


Code:

Sub FindCopyAll_Alt()
'
' FindCopyAll_Alt Macro
''I am using row one for labels so my first usable row is row 2
pos = 2
'
'I want to delete the "Search Results" sheet if it exists, So I am going to force an error
On Error GoTo NewSheet
'
'This blocks the message "Deleting Sheet Will Lose Data"
Application.DisplayAlerts = False
'
'This selects the results sheet, if it does not exist then we will go to NewSheet
Sheets("Search Results").Select
'
'This Deletes the Results Sheet
ActiveSheet.Delete
'
'This re-enables our error messages
Application.DisplayAlerts = True
'
'Create the Results Sheet
NewSheet:
  Sheets.Add After:=ActiveSheet
  ActiveSheet.Name = "Search Results"
  ActiveSheet.Move Before:=Sheets(1)
'What Text do you want to search for?
MyStr = InputBox("Enter Text to Find", "Find Text Macro", "select", 100, 100)
'
'These are my Labels
Range("E1").Value = "Recommended Shortcuts:"
Range("F2").Value = "CTRL + SHIFT + V"
Range("F3").Value = "CTRL + SHIFT + C"
Range("F4").Value = "CTRL + SHIFT + X"
Range("F5").Value = "CTRL + SHIFT + Z"
Range("H3").Value = "_"
Range("H4").Value = ",_"
Range("H5").Value = ".__"
Range("I2").Value = "(Compile A1 List ONLY)"
Range("I3").Value = "(Compile A1 List and SPACE)"
Range("I4").Value = "(Compile A1 List, COMA, SPACE) "
Range("I5").Value = "(Compile A1 List, PERIOD, SPACE, SPACE)"
Range("B1").Value = "Rand"
'
'This resets our normal error routines
On Error GoTo 0
'
'Quit if search text is empty
If MyStr = "" Then Exit Sub
'
'Search for the Search String in each workbook except the results sheet
For Each ws In Sheets
'
If ws.Name = "Search Results" Then GoTo Skip
If ws.Name = "Srch" Then GoTo Skip
If ws.Name = "Rand" Then GoTo Skip
'
MyName = ws.Name
'
  MyString = ""
'
  With ws.Cells
      Set rngFind = .Find(MyStr, .Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole)
      If Not rngFind Is Nothing Then
          strFirstAddress = rngFind.Address
'
          Do
                MyString = MyString & MyName & "!" & rngFind.Address & ", "
                Set rngFind = .FindNext(rngFind)
          Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstAddress
      End If
    End With
'
'If Match Found then store data in Column A of results sheet
    If MyString <> "" Then
'
'Convert MyString into an Array, so it is easy to save
    MyArray = Split(MyString, ",")
'
'Where to save MyArray
    Temp = Range(Cells(pos, 1), Cells(pos + UBound(MyArray), 1)).Address
'
'Save MyArray, The array is horizontal, transpose makes it vertical
    Sheets("Search Results").Range(Temp).Value = Application.Transpose(MyArray)
'
'We need to increment pos so the next lot of data is saved below the existing data
    pos = pos + UBound(MyArray)
'
  End If
'
Skip:
Next

'This Adds Randomizer Column
With Sheets("Search Results")

'Number of times Loop is ran
For Count = 2 To pos - 1


Temp = CStr(Application.Trim(Sheets("Search Results").Cells(Count, 1)))
'
Range("B2:B" & Cells(Rows.Count, "A").End(xlUp).Row).Formula = "=Rand()"
Exit For
Next
'
    Range("B2").Select
    Selection.End(xlDown).Select
    Selection.ClearContents
    Selection.End(xlUp).Select
    Selection.End(xlUp).Select
End With

'Copy and Paste Column A - Delete This and downward after Rand Set up
    Range("A2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range("A2:A1353").Select
    Selection.Copy
    Sheets("Rand").Select
    ActiveSheet.Paste
                  'Select Row 1 Change back to (0, 1) if continued code isn't working
    ActiveCell.Offset(-1, 1).Range("A1").Select
   
'Attempting to use cell contents as my find all criteria
'Continuing Code needs to go here
End Sub

Sample.xlsm

Email a range of excel cells using VBA produces infinite loop HELP

$
0
0
Hi everyone, this is my first time posting here... I am creating a payroll file in which I am trying to send a range of cells to the emails addresses of our employees. I get it to do everything fine except the loop does not end and ends up reproducing the emails. All help is welcome. My coding constructs may not be the best.
The excel sheet currently contains 170 rows to be emailed. It will grow so just wanted to put that out there.

Code:

Sub SendMailsFromList()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim cell As Range
    Dim rng As Range
    Dim Ash As Worksheet
    Dim ws As Worksheet
    Dim ebody As String
    Dim i As Integer
   
    ebody = "See below for your pay information for this pay period. If there are any errors please reach out to your team coach/supervisor." & "<br>"
   
    Set Ash = ActiveWorkbook.ActiveSheet
   
    On Error GoTo cleanup
   
    Set OutApp = CreateObject("Outlook.Application")

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With
   
    For i = 1 To 171
   
    For Each cell In Ash.Columns("B").Cells.SpecialCells(xlCellTypeConstants)
            Ash.Range("A1:AC171").AutoFilter Field:=2, Criteria1:=cell.Value

            With Ash.AutoFilter.Range
                On Error Resume Next
                Set rng = .SpecialCells(xlCellTypeVisible)
                On Error GoTo 0
            End With

            Set OutMail = OutApp.CreateItem(0)
            On Error Resume Next
           
            With OutMail
                .To = cell.Value
                .Subject = "Payroll file"
                .HTMLBody = ebody & RangetoHTML(rng)
                .Display
            End With
            On Error GoTo 0

            Set OutMail = Nothing
            Ash.AutoFilterMode = False
           
            cell.Offset(1, 0).Select
Next i

cleanup:
    Set OutApp = Nothing
    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
End Sub


How to Check folder exist with ID

$
0
0
Help me

I have some folder with : {ID} {Name} ({Name} = use Unicode)
I checked with :

Formula:

If Dir(tmp5, vbDirectory) = vbNullString Then .CreateFolder tmp2



Same :
tmp5 = "C:\Windows\156481*"

If someone created folder "156481 ....." (... = {name}) func pass Create folder

Full my code:
Formula:

Option Explicit

Sub CreateFolder(ByVal Data_Table As Range, ByVal Data_Table1 As Range, ByVal Data_Table2 As Range, ByVal Data_Table3 As Range)
Dim tmpArr, tmpArr1, tmpArr2, tmpArr3, Arr(), Arr1(), Arr2(), Arr3()
Dim lR As Long, lC As Long
Dim tmp1 As String, tmp2 As String, tmp3 As String, tmp4 As String, tmp5 As String, sRoot As String, tmpsRoot As String, folder As String
On Error GoTo ExitSub
tmpArr = Data_Table2.Value
tmpArr1 = Data_Table1.Value
tmpArr2 = Data_Table.Value
tmpArr3 = Data_Table3.Value
sRoot = "M" & ":\" & Sheet1.Range("O1") & "\test\"
ReDim Arr(1 To UBound(tmpArr, 1), 1 To UBound(tmpArr, 2))
ReDim Arr1(1 To UBound(tmpArr1, 1), 1 To UBound(tmpArr1, 2))
ReDim Arr2(1 To UBound(tmpArr2, 1), 1 To UBound(tmpArr2, 2))
ReDim Arr3(1 To UBound(tmpArr3, 1), 1 To UBound(tmpArr3, 2))
With CreateObject("Scripting.FileSystemObject")
For lC = 1 To UBound(tmpArr, 2)
For lR = 1 To UBound(tmpArr, 1)

tmp1 = Trim(tmpArr(lR, lC))
tmp3 = Trim(tmpArr1(lR, lC))
tmp4 = Trim(tmpArr2(lR, lC))

If tmp4 = "Begin" Then
tmp3 = Replace(tmp3, Chr(47), "-") '47 /
tmpsRoot = sRoot & tmp3 & "\"
If Not .FolderExists(tmpsRoot) Then .CreateFolder tmpsRoot
End If

If tmp4 = "Dot" Then
Dim tam() As String
tmp1 = Replace(tmp1, Chr(47), "_") '47 /
tmp1 = Replace(tmp1, Chr(92), " ") '92 \
tmp1 = Replace(tmp1, Chr(42), " ") '42 *
tmp1 = Replace(tmp1, Chr(58), " ") '58 :
tmp1 = Replace(tmp1, Chr(34), " ") '34 "
tmp1 = Replace(tmp1, Chr(64), " ") '64 @
tmp1 = Replace(tmp1, Chr(62), " ") '62 >
tmp1 = Replace(tmp1, Chr(60), " ") '60 <
tmp1 = Replace(tmp1, Chr(124), " ") '124 |
tmp1 = Replace(tmp1, " ", " ")
If lC = 1 Then
tmp2 = tmpsRoot & tmp1
tmp5 = tmpsRoot & Trim(tmpArr3(lR, lC)) & Chr(42)
Else
tmp2 = Arr(lR, lC - 1) & "\" & tmp3 & " " & tmp1
End If
Arr(lR, lC) = tmp2
'folder = Len(Dir(tmp5, vbDirectory))
If Dir(tmp5, vbDirectory) = vbNullString Then .CreateFolder tmp2
'If Not .FolderExists(folder) Then .CreateFolder tmp2
End If
Next
Next
End With
ExitSub:
End Sub
Sub Main()
Dim SrcRng As Range, SrcRng1 As Range, SrcRng2 As Range, SrcRng3 As Range
Set SrcRng = Sheet2.Range("A1:A3000")
Set SrcRng1 = Sheet2.Range("B1:B3000")
Set SrcRng3 = Sheet2.Range("D1:D3000")
Set SrcRng2 = Sheet2.Range("E1:E3000")
CreateFolder SrcRng, SrcRng1, SrcRng2, SrcRng3
End Sub

Sub Del()
Sheet1.Range("A1:E3000").ClearContents
End Sub

Sub paste()
Worksheets("Sheet1").Range("A1").Select
ActiveSheet.PasteSpecial NoHTMLFormatting:=True
End Sub

Sub auto()
paste
Main
Del
End Sub

[SOLVED] Help, Need to Truncate Cells before running Macro!

$
0
0
Hey guys, I have a problem and can't seem to find a solution. I tried creating a macro that would truncate all cells to 15 character and then run the rest of the following macro. It keeps giving me a compile error and I don't know why. This code works great but it doesn't truncate all the cells before it runs. The first thing that should be done is limiting all the cells to 15 characters…Below is my code. Suggestions?

Code:

Sub GetSKU()
    Dim w1 As Worksheet
    Dim w2 As Worksheet
    Set w1 = Sheets("Sheet1")
    Set w2 = Sheets("Sheet2")
    Dim lr As Long
    lr = w1.Range("A" & Rows.Count).End(xlUp).Row
    Dim lr2 As Long
    Dim i, k As Long
    Dim L As Long
    Dim S As String
   
    Application.ScreenUpdating = False
    For i = 1 To lr
        If Left(w1.Range("A" & i), 4) = "SKU:" Then
            L = Len(w1.Range("A" & i)) - 5
            For k = 1 To w1.Cells(i - 1, 1).Value
                lr2 = w2.Range("A" & Rows.Count).End(xlUp).Row
                w2.Range("A" & lr2 + 1) = Right(w1.Range("A" & i), L)
                w1.Range("A" & i).Offset(-1, 1).Copy w2.Range("B" & lr2 + 1)
            Next
        End If
    Next i
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    MsgBox ("Task Completed")
   
Dim LastRow

LastRow = Sheets("Sheet2").Range("A1048576").End(xlUp).Row

For r = 1 To LastRow
    Sheets("Sheet2").Range("C" & r).Value = Sheets("Sheet2").Range("B" & r).Value
    Sheets("Sheet2").Range("B" & r).Value = Sheets("Sheet2").Range("A" & r).Value
Next

Sheets("Sheet2").Range("A1").Value = "Decals Needed"

For r = 2 To LastRow
    Sheets("Sheet2").Range("A" & r).Formula = Application.WorksheetFunction.CountIf(Sheets("Sheet2").Range("B:B"), Sheets("Sheet2").Range("B" & r))
Next

Sheets("Sheet2").Range("A1:C" & LastRow).RemoveDuplicates Columns:=Array(1, 2, 3), _
        Header:=xlYes

End Sub

Copy Data in Mastersheet from various worksheets in the folder

$
0
0
Respected Experts,

Everyday I receive many worksheets which has data pulled from various resources. At end of day, I have to collate all these sheets into one. I have found one macro which copies the data from different worksheets in the folder to the master sheet.

But this code is not working for me, no data is filled up in my mastersheet. Kindly suggest what I am missing in my code.

Code:

Sub copyDataFromMultipleWorkbooksIntoMaster()

Dim FolderPath As String, FilePath As String, Filename As String

FolderPath = "C:\Users\hjaspaul\Desktop\Moses Data"

FilePath = FolderPath & "*.xls*"
Filename = Dir(FilePath)

Dim lastrow As Long, lastcolumn As Long

Do While Filename <> ""
Workbooks.Open (FolderPath & Filename)

lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
lastcolumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(2, 1), Cells(lastrow, lastcolumn)).Copy
Application.DisplayAlerts = False
ActiveWorkbook.Close

erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 1), Cells(erow, 13))

Filename = Dir

Loop
Application.DisplayAlerts = True
End Sub

Check cell content from one row to second row and put unique values in 3rd row

$
0
0
I get lot of domains and My job is to find contact info for all these domains. I am attaching one excel file. There are 3 rows, one master url , new url , unique urls. Let me explain what these names mean

1) Master url - I have already found contact info of 3000 websites. All these urls lie in master url row.
2) New url - I found new urls, websites which are new and might need my company's help. I need to find contact info of these sites, but first I need to remove duplicate urls from this list.

Now, Obviously "new urls" lot of times contain urls for which I have already found contact info. Last time, I found 2000 contact infos and around 1500 were duplicated. My boss was very upset with me. I want a way, in which if I put new urls in "new url" row. I should click a button or run a vba script, it should put unique urls in row 3 (unique urls). Can someone help me please.
Attached Files

[SOLVED] Help in moving summary sheets to the front

$
0
0
Hi,

In the attached excel, there are multiple sheets. Most of them would in the name of sheet1, Sheet2, Sheet3,..... etc

Where few of the sheets will be named as Summary, Summary1, Summary2, Summary3,.....

Now i want all the sheet which have the sheet name as Summary need to come to the front to all the other sheets.

Note: In attachment, it may be 3 or 4 summary, where in my regular working excel books will have even more summary sheets.

Regards
Balamurugan.D
91 9884045531
Attached Files

Cell Adresses of changing cells in the worksheet

$
0
0
I have a form where user enters a value.That value is then written in to a cell in the worksheet.After that value is written the values of the cells that contains formulas change to "REPAIR". I want to identify the cells that contain "REPAIR" and get the address of those cells in another worksheet along with the date and time the change happened. Could you please help me on this?

Copy Range Based Linked Cell in ActiveX ComboBox

$
0
0
Here is My Code, Please Help, How to fix it ...

Code:

Private Sub ComboBox1_Change()

    Dim wsDest As Worksheet
    Dim wsSource As Worksheet
    Dim rngData As Range
    Dim baris As Integer
    Dim kolom As Integer
    baris = Range("G17").Value
    kolom = Range("M17").Value
   
    Set wsDest = Worksheets("Displaypage")
    Set wsSource = Worksheets("Source")
    Set rngData = wsSource.Range("a1:c5")
   

    wsDest.Range("a1:c5").ClearContents
    If baris = -1 Then Exit Sub 'Nothing selected
    rngData.Cells(1).Offset(baris, kolom).Resize(5, 3).Copy
    wsDest.Range("a1").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
       
End Sub


VBA Loop that check cells in a column(Range)then copy if criteria match

$
0
0
Hello
Can someone plse help me with a vba code for the following,

I got a list of names from A6 to A20. In column D (D6-D20) i got figures
I need to make a code that wil start looking from D6 for a cell containing a zero. (Then i can add my code to copy name in column A to column F)
(After my macro is done) the code must then check the next row and so on untill it reach the end of the range - D20

I will be so thankfull if anybody can help me.

Eben

Help request to insert a title in between salutation and the name of person in messagebody

$
0
0
Hi friends,
The file name of attachment is the same as the name of the person in column ‘N’.
If I add a title to it then it gives error while converting word file to pdf. So there is no title in column ‘N’. The program matches the name of person column ‘N’ to the attachment stored in the ‘OUTPUT’ folder and attaches it to the mail.

My requirement is that I want a title in between the salutation and the name of person in the mail body which is in column ‘C’. We can insert it only after attaching the attachment because if we insert it before attaching the attachment then it will not match the name of attachment and name of person and as a result the attachment will not be attached. So I want to add it after attaching the attachment. There are two macros in the workbook namely ‘Birthday’ and ‘Holiday’.

Any help will be highly appreciated.

Thanking you in anticipation.
Attached Files

VBA running different on 4th tab

$
0
0
I've linked my sheet. The only code I can find is on the order(4) tab.
However, the code is running fine on the other 'order' tabs. It's just the (4) that is in incorrect to what I need. I need it to run the same on these 4 order sheets.
I need the adjacent columns to delete not all the way down.
I'm at a loss to fix this since I can't locate the code running on the other tabs.
Also I did not write the code, I'm very new to VBA.

https://www.dropbox.com/s/er4crgg0si...ller.xlsm?dl=0

thanks

Short-Cut Key vs Ribbon Button Macro Activating

$
0
0
I have a very strange problem in running a macro in Excel 2010 on my Windows 10 machine.

This macro called "CreateHurstChart" can be activated from a button located on the Ribbon under the Design tab (Chart Tools) when I have HURST.xltm loaded in. The macro is found in the PERSONAL.XLSB file (hidden) that is stored in the c:\users\Smith\AppData\Roaming\Microsoft\Excel\XLSTART directory path.

When I have HURST.xltm loaded and click on the button on the ribbon to run the macro, the VBA code does its thing and then pops open a Open File dialog window so that I can select a CSV file to load.

Once I double-click the file, the Open File window closes, the data from the CSV is loaded into a sheet, and then the VBA code continues by working on the data and creating a chart.

HOWEVER...

I had gone directly into the Properties of the CreateHurstChart macro and assigned a Short-cut key combination CTRL-SHIFT-S.

Thus, when I have HURST.xltm loaded, instead of clicking on the ribbon button as outlined above but instead using the Short-cut key combination, it goes through the motions as before up to where the Open File dialog pops up, I double-click the file to load, it loads it into a sheet, and then the VBA STOPS!

It doesn't process the CSV data it just loaded.

I cannot for the life of me figure out why it works fine using the ribbon button but stops after loading the CSV data using the Short-cut key combination.

Any ideas?

TIA

Autofilter for multiple not equal values

$
0
0
I add autofilter for excel table as follows.

Code:

With Sheets("Summary")
    With .ListObjects("Summary").Range
        .AutoFilter Field:=1, Criteria1:=">400000", Operator:=xlOr, Criteria2:=Array("<>440400", "<>440600", "<>440300")
        .AutoFilter Field:=5, Criteria1:=">110", Operator:=xlAnd, Criteria1:="<105"
        .SpecialCells(xlCellTypeVisible).Copy
    End With
End With


In the result I am geeting value greater than 400000 . But I am getting 440400,440600 and 440300 values. How Can I add both filters?
Viewing all 49975 articles
Browse latest View live