excel - VBA, cmdBarButton not executing entire Sub -
For some reason sub head ()
is not fully executed when my menu button However, if I execute sub head ()
from the editor with F5 manually, then it should work as soon as I click on my "P Wave" button If I click on, only update call
runs, can someone explain this? This is very confusing.
There is my code in module 1. Private sub workbook_on ()
Private sub head () 'Run all the necessary subways to process the spreadsheet Call parasaysiv call call resize columns call updateCell call hideColumns End Sub personal sub hideColumns ()' uneccessary Hide the column ActiveSheet.Range. ("E: F, L: V, X: AdWords, AY: BD, BI: BK, BM: CB, CF1") EntireColumn.Hidden = True End Sub Personal Sub-resizeColumns () 'Fit to Data ActiveSheet.Columns.AutoFit ActiveSheet.Range ("A1"). EntireColumn.ColumnWidth = 10 ActiveSheet.Range ("B1"). Change the size of EntireColumn.ColumnWidth = 5 ActiveSheet cells. Range ("C1") EntireColumn.ColumnWidth = 5 ActiveSheet.Range ("D1"). EntireColumn.ColumnWidth = 5 ActiveSheet.Range ("J1"). EntireColumn.ColumnWidth = 5 ActiveSheet.Range ("K1"). EntireColumn .ColumnWidth = 5 ActiveSheet.Range ("W1") EntireColumn.ColumnWidth = 10 ActiveSheet.Range ("BE: Bihar") ... EntireColumn.ColumnWidth = 5 ActiveSheet.Range ("BL1") EntireColumn.C olumnWidth = 45 ActiveSheet.Range. ("CG: CN") EntireColumn.ColumnWidth = 5 End Sub personal sub updateCell () "Notes" to make colum line breaks' because cell update appeared dim currentValue string slow lRow form active (as long as with activeSheet) LRO =. Range ("BL" & amp; .Rows.Count) .End (xlUp) .Range (with .Row "BL1: BL" & amp; lRow). WrapText = False .Value = .Value End With End End Sub personal sub parseCSV () "Pars" Notes "column and return mood / string slow lRow as long as slow keyword string slow mood string dim I as lRow = ActiveSheet () range (" BL "& amp; Keywords as for their apropriate cells as dim csv string dim fullArray (as);. ActiveSheet () .ows.Count). (XlUp). End (xlUp). Create the 'Find the previous row' loop for the 'I = 3' which is spread through the data CSV = ActiveSheet.Range ("BL" & amp; i) fullArray () = Split (CSV, vbNewLine) UBound (FullArray ()) & gt; = 2 then 'then ActiveSheet.Range ("CE" & amp; i) .Value = fullArray (2)' third line ActiveSheet.Range ("Enter CD" & Amp; i) to ignore errors .Value = fullArray (1) Enter the second line if finished, sub-private sub-loop test () 'test loop DIM IAS long dim LR o Long Lorenzo = activate (for pars function). Range ("BL" & ActiveSheet (Rows.Count) .end (xlUp) .row i = lRow ActiveSheet.Range (for "3 CDs"; I) .Value = "test" next I end the sub sub-private sub parseCSVTest () 'test parsing' notes and columns (their apropriate cells retarded CSV string CSV = ActiveSheet.Range ("BL4") Dim fullArray version fullArray = Split (CSV, vbNewLine) Mood version Mood = Application Back to Mind / Keyword fullArray, as in Index, 1, 3) Variant Keywords as Dim Keywords = Application .index (full array, 1, 2) ActiveSheet.Range ("CD4"). Value = Mood ActiveSheet.Range ("CE4"). Value = Keyword Expiry Sub
My code in workbook here
Private sub Workbook_Open () MsgBox "Open is working" Slim cmbBar CommandBar dim cmbControl form Set cmbBar = Application.CommandBars ("Worksheet menu bar") set as CommandBarControl cmbControl = cmbbar.Controls.Add (type: = msoControlPopup, temp: = true) Adds a menu item to 'm' cmbControl .Caption = "P Wave" .menu bar menu items with the "menu item" with ControlsAdd (type: = msoControlButton) .Caption = "Process Sheet" to A Drop-down button adds adds a description of menu items Konakshn = "main ()" specified macro runs. Specifies an icon with end to end with the FIDEID = 10 9 'dropdown end sub-sub workbook Anterk off (Cancel as Boolean) Error on resume Next if the menu item has already been deleted application. Commands ("Worksheet Menu Bar") Control ("macro macros"). Delete 'menu item Remove MSBbox "Stop working" and all
Try it:
.onction = "ThisWorkbook.Main" 'runs specified macros
or
. Onion = "main" 'runs the specified macro
Comments
Post a Comment