Search Results

Search found 1127 results on 46 pages for 'macro'.

Page 4/46 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • automatically execute an Excel macro on a cell change

    - by namin
    How can I automatically execute an Excel macro each time a value in a particular cell changes? Right now, my working code is: Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("H5")) Is Nothing Then Macro End Sub where "H5" is the particular cell being monitored and Macro is the name of the macro. Is there a better way?

    Read the article

  • Outlook macro runs through 250 iterations before failing with error [migrated]

    - by Senoculus
    Description: I have an Outlook macro that loops through selected emails in a folder and writes down some info to a .csv file. It works perfectly up until 250 before failing. Here is some of the code: Open strSaveAsFilename For Append As #1 CountVar = 0 For Each objItem In Application.ActiveExplorer.Selection DoEvents If objItem.VotingResponse <> "" Then CountVar = CountVar + 1 Debug.Print " " & CountVar & ". " & objItem.SenderName Print #1, & objItem.SenderName & "," & objItem.VotingResponse Else CountVar = CountVar + 1 Debug.Print " " & CountVar & ". " & "Moving email from: " & Chr(34) & objItem.SenderName & Chr(34) & " to: Special Cases sub-folder" objItem.Move CurrentFolderVar.Folders("Special Cases") End If Next Close #1 Problem After this code runs through 250 emails, the following screenshot pops up: http://i.stack.imgur.com/yt9P8.jpg I've tried adding a "wait" function to give the server a rest so that I'm not querying it so quickly, but I get the same error at the same point.

    Read the article

  • MACRO Question: Returning pointer to a certain value

    - by Andrei Ciobanu
    Is it possible to write a MACRO that has a type and a value as its input parameters (MACRO(type,value)), and returns a valid pointer to a location that holds the submitted value. This macro should perform like the following function, but in a more generic manner: int *val_to_ptr(int val){ int *r = NULL; r = nm_malloc(sizeof(*r)); *r = val; return r; } Where nm_malloc() is a failsafe malloc. The Macro usage should be compatible with this usage: printf("%d",*MACRO(int,5)); Is it possible to achieve that ?

    Read the article

  • Translate sequence in macro parameters to separate macros

    - by Alex Tiger
    How to acces each element in macro if the definition is like MACRO(name, seq) and the code is like: MACRO("TheName", (Elem1) (Elem2) (Elem3) ) I want to generate the next code: MACRO("TheName", ELEMMACRO(Elem1) ELEMMACRO(Elem2) ELEMMACRO(Elem3) ) Or something like that. In other words, I want to process every parameter separately (I don't care of definition, even if it will be something like MACRO("TheName", Elem1, Elem2, Elem3 ) There could be more elements, there could be less. I have tried V_ARGS (I need it only for gcc), but I can only copy all the elements by that, not to process them separately. What can I do? P.S. Because of some reasons, I can't use Boost.

    Read the article

  • Importing CSV files into Excel using a macro

    - by B-Ballerl
    I'm want to develop a macro where in my excel worksheet I type a date in a specific cell, and the macro will go into a folder containing text files. A database you could say. I want it to find the corresponding file name which is written as a date, put the data through a delimeter, and paste into the cells directly below where I orginally put the date. I'm very new with Macro's so if you must answer try to be a little more simple than you might usually be. Thanks In Advance if anyone can Help!! Update The folder will always be in the same place and the text files will all be formatted DD_MM_YYYY. And there cells below will always be empty Some Pictures to Make what I'm asking, easier to figure out. View the Image in a new tab for better res.

    Read the article

  • Macro is not Cooperating with Quotations in Excel VBA

    - by B-Ballerl
    I Have a macro containing a line that will change the formula of a cell using R1C1 formula type. The formula is: ActiveCell.FormulaR1C1 = _ "=IF(R[0]C[-2]=0,"",(R[0]C[-20]-R[0]C[-16]))" When ever I attempt to run the macro it always comes up with a dialog box saying Run-time error '1004': Application-defined or object-defined error. And when you click debug it highlights those 2 lines in the macro. And I can't figure out how to fix it. Can anyone help?

    Read the article

  • Excel Help: Macro is not Cooperating with Quotations!!

    - by B-Ballerl
    Hi all, I Have a macro containing a line that will change the formula of a cell using R1C1 formula type. The formula is: ActiveCell.FormulaR1C1 = _ "=IF(R[0]C[-2]=0,"",(R[0]C[-20]-R[0]C[-16]))" When ever I attempt to run the macro it always comes up with a dialog box saying Run-time error '1004': Application-defined or object-defined error. And when you click debug it highlights those 2 lines in the macro. And I can't figure out how to fix it. Can anyone help?

    Read the article

  • Excel Macro Help - Data Input

    - by B-Ballerl
    I'm want to develop a macro where in my excel worksheet I type a date in a specific cell, and the macro will go into a folder containing text files. A database you could say. I want it to find the corresponding file name which is written as a date, put the data through a delimeter, and paste into the cells directly below where I orginally put the date. I'm very new with Macro's so if you must answer try to be a little more simple than you might usually be. Thanks In Advance if anyone can Help!!

    Read the article

  • Excel Macro Runtime error 428 in Excel 2003

    - by Adam
    Hi I have created a xlt excel template which works fine in Excel 2007 under compatibility mode and shows no errors on compatibility check. The template runs a number of Macros which creates pivot tables and charts. When a colleague tries to run the same xlt on excel 2003 they get a Runtime error 428 (Object does not support this property or method). The runtime error fails at this point; ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "raw!R1C1:R65536C37", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="Frontpage!R7C1", TableName:="PivotTable2", _ DefaultVersion:=xlPivotTableVersion10 Any help would be appreciated. This is the full Macro; Sub Auto_Open() ' ' ImportData Macro ' Macro to import data, Data must be in your local D: Drive and named raw.csv ' ' Sheets("raw").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;d:\raw.csv", Destination:=Range _ ("$A$1")) .Name = "raw_1" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 850 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = False .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With ' ' AddMonthColumn Macro ' ' Sheets("raw").Select Range("AK1").Select ActiveCell.FormulaR1C1 = "Month" Range("AK2").FormulaR1C1 = "=DATE(YEAR(RC[-36]),MONTH(RC[-36]),1)" LastRow = ActiveSheet.UsedRange.Rows.Count Range("AK2").AutoFill Destination:=Range("AK2:AK" & LastRow) Columns("AK:AK").EntireColumn.AutoFit Columns("AK:AK").Select Selection.NumberFormat = "mmmm" With Selection .HorizontalAlignment = xlCenter End With Columns("AK:AK").EntireColumn.AutoFit Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ' ' Add Report Information [Text] ' Sheets("Frontpage").Select Range("A2:N2").Select Selection.Merge ActiveCell.FormulaR1C1 = "Service Activity Report" With Selection.Font .Size = 20 End With Range("A3:N3").Select Selection.Merge ActiveCell.FormulaR1C1 = InputBox("Customer Name") With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter End With Range("A4:N4").Select Selection.Merge ActiveCell.FormulaR1C1 = InputBox("Date Range dd/mm/yyyy - dd/mm/yyyy") With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter End With ' ' IncidentsbyPriority Macro ' ' Sheets("Frontpage").Select Range("A7").Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "raw!R1C1:R65536C37", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="Frontpage!R7C1", TableName:="PivotTable2", _ DefaultVersion:=xlPivotTableVersion10 Sheets("Frontpage").Select Cells(7, 1).Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=Range("Frontpage!$A$7:$H$22") ActiveChart.ChartType = xlColumnClustered With ActiveSheet.PivotTables("PivotTable2").PivotFields("Priority") .Orientation = xlRowField .Position = 1 End With ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _ "PivotTable2").PivotFields("Case ID"), "Count of Case ID", xlCount ActiveChart.Parent.Name = "IncidentsbyPriority" ActiveChart.ChartTitle.Text = "Incidents by Priority" Dim RngToCover As Range Dim ChtOb As ChartObject Set RngToCover = ActiveSheet.Range("D7:L16") Set ChtOb = ActiveSheet.ChartObjects("IncidentsbyPriority") ChtOb.Height = RngToCover.Height ' resize ChtOb.Width = RngToCover.Width ' resize ChtOb.Top = RngToCover.Top ' reposition ChtOb.Left = RngToCover.Left ' reposition ' ' IncidentbyMonth Macro ' ' Sheets("Frontpage").Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "raw!R1C1:R65536C37", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="Frontpage!R18C1", TableName:="PivotTable4", _ DefaultVersion:=xlPivotTableVersion10 Sheets("Frontpage").Select Cells(18, 1).Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=Range("Frontpage!$A$18:$H$38") ActiveChart.ChartType = xlColumnClustered With ActiveSheet.PivotTables("PivotTable4").PivotFields("Month") .Orientation = xlRowField .Position = 1 End With ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("Case ID"), "Count of Case ID", xlCount ActiveChart.Parent.Name = "IncidentbyMonth" ActiveChart.ChartTitle.Text = "Incidents by Month" Dim RngToCover2 As Range Dim ChtOb2 As ChartObject Set RngToCover2 = ActiveSheet.Range("D18:L30") Set ChtOb2 = ActiveSheet.ChartObjects("IncidentbyMonth") ChtOb2.Height = RngToCover2.Height ' resize ChtOb2.Width = RngToCover2.Width ' resize ChtOb2.Top = RngToCover2.Top ' reposition ChtOb2.Left = RngToCover2.Left ' reposition ' ' IncidentbyCategory Macro ' ' Sheets("Frontpage").Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "raw!R1C1:R65536C37", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="Frontpage!R38C1", TableName:="PivotTable6", _ DefaultVersion:=xlPivotTableVersion10 Sheets("Frontpage").Select Cells(38, 1).Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=Range("Frontpage!$A$38:$H$119") ActiveChart.ChartType = xlColumnClustered With ActiveSheet.PivotTables("PivotTable6").PivotFields("Category 2") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable6").PivotFields("Category 3") .Orientation = xlPageField .Position = 1 End With ActiveSheet.PivotTables("PivotTable6").AddDataField ActiveSheet.PivotTables( _ "PivotTable6").PivotFields("Case ID"), "Count of Case ID", xlCount ActiveChart.Parent.Name = "IncidentbyCategory" ActiveChart.ChartTitle.Text = "Incidents by Category" Dim RngToCover3 As Range Dim ChtOb3 As ChartObject Set RngToCover3 = ActiveSheet.Range("D38:L56") Set ChtOb3 = ActiveSheet.ChartObjects("IncidentbyCategory") ChtOb3.Height = RngToCover3.Height ' resize ChtOb3.Width = RngToCover3.Width ' resize ChtOb3.Top = RngToCover3.Top ' reposition ChtOb3.Left = RngToCover3.Left ' reposition ' ' IncidentsbySiteandPriority Macro ' ' Sheets("Frontpage").Select Range("A71").Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "raw!R1C1:R65536C37", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="Frontpage!R71C1", TableName:="PivotTable3", _ DefaultVersion:=xlPivotTableVersion10 Sheets("Frontpage").Select Cells(71, 1).Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=Range("Frontpage!$A$71:$H$90") ActiveChart.ChartType = xlColumnClustered With ActiveSheet.PivotTables("PivotTable3").PivotFields("Site Name") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable3").PivotFields("Priority") .Orientation = xlColumnField .Position = 1 End With ActiveSheet.PivotTables("PivotTable3").AddDataField ActiveSheet.PivotTables( _ "PivotTable3").PivotFields("Case ID"), "Count of Case ID", xlCount ActiveChart.Parent.Name = "IncidentbySiteandPriority" ' ActiveChart.ChartTitle.Text = "Incidents by Site and Priority" Dim RngToCover4 As Range Dim ChtOb4 As ChartObject Set RngToCover4 = ActiveSheet.Range("H71:O91") Set ChtOb4 = ActiveSheet.ChartObjects("IncidentbySiteandPriority") ChtOb4.Height = RngToCover4.Height ' resize ChtOb4.Width = RngToCover4.Width ' resize ChtOb4.Top = RngToCover4.Top ' reposition ChtOb4.Left = RngToCover4.Left ' reposition Columns("A:G").Select Range("A52").Activate Columns("A:G").EntireColumn.AutoFit End Sub

    Read the article

  • How to access items by "group" in an Outlook VB macro?

    - by Noah Yetter
    By "group" I mean the collapsible classifications that you get when you enable View-Arrange By-Show in Groups. This divides e.g. messages in a folder into Today, Yesterday, Last Week, Two Weeks Ago, and so on. What I'd like to be able to do is iterate over the messages that are currently classified within a given group. Is this possible?

    Read the article

  • word macro to save a selected range into database.

    - by Thunder
    Is there a way in word to save a selected portion into the database as range object.So that we can later retrieve it . It is required to generate a report in word ,the section needs to be repeated many times. I have searched net for quite some time but not much material is found. thanks.

    Read the article

  • How to create a Appointment in a Shared Calendar (Sharepoint) with VBA (Macro)?

    - by Diogo K.
    I am actually trying to make an appointment from an excel spreadsheet. I have all the information of the appointment, like subject, body, start and end dates, I actually can create an appointment but only with my personal calendar in outlook. How do I copy/move/create an appointment in a shared calendar in a sharepoint server? I've tried: Dim apOL As Object Dim objFolder As Folder Dim cro As String Set apOL = CreateObject("Outlook.Application") Set oItem = apOL.CreateItem(olApItem) Set MAPISession = apOL.Session ... cro = "stssync://sts/?ver=1.0&type=calendar&cmd=add-folder&base-url=(MY SP SERVER)&list-url=%2FLists%2FCronograma%20%20%2Fcalendar%2Easpx&guid=%7B02717CEF%2D404F%2D482F%2DA131%2D5C3C245CD268%7D&site-name=Testes&list-name=Cronograma%20-" ... Set objFolder = MAPISession.OpenSharedFolder(cro, Null,Null,Null) It gives me the error "Type Mismatch" I'd try to get the objFolder as the Sharepoint Folder then later create an local appointment and then try an Item.Move objFolder Is it the correct way?

    Read the article

  • How do you write a macro for a special character in LibreOffice?

    - by JasperKov
    Does anyone know how to write a macro for a special character? I know LibreOffice currently doesn't have a way to set a special character to a keyboard shortcut. However, I want to work around this with a macro. My plan is to create a macro for a special character then set a keyboard shortcut to that macro. Problem is I don't know the first thing about writing a macro. Any one have a template or something that works? I also know about the compose key, but I guess I am lazy and want to actually insert special characters with as few keys as possible.

    Read the article

  • Macro vs. Static functions in Header

    - by wirrbel
    for a lot of quick tasks where one could employ a function f(x,y), in plain C, macros are used. I would like to ask specifically about these cases, that are solvable by a function call (i.e. macros used for inlining functions, not for code expansion of arbitrary code). Typically C functions are not inlined since they might be linked to from other C files. However, static C functions are only visible from within the C file they are defined in. Therefore they can be inlined by compilers. I have heard that a lot of macros should be replaced by turning them into static functions, because this produces safer code. Are there cases where this is a not good idea? Again: Not asking about Code-Production macros with ## alike constructs that cannot at all be expressed as a function.

    Read the article

  • Pointless 'MIDL_INTERFACE' Macro in winapi?

    - by nebukadnezzar
    After browsing some old code, I noticed that some classes are defined in this manner: MIDL_INTERFACE("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX") Classname: public IUnknown { /* classmembers ... */ }; However, the macro MIDL_INTERFACE is defined as: #define MIDL_INTERFACE(x) struct in C:/MinGW/include/rpcndr.h (somewhere around line 17). The macro itself is rather obviously entirely pointless, so what's the true purpose of this macro?

    Read the article

  • Writing a C Macro

    - by shaharg
    Hi, I have to write a macro that get as parameter some variable, and for each two sequential bits with "1" value replace it with 0 bit. For example: 10110100 will become 10000100. And, 11110000-00000000 11100000-100000000 I'm having a troubles writing that macro. I've tried to write a macro that get wach bit and replace it if the next bit is the same (and they both 1), but it works only for 8 bits and it's very not friendly... P.S. I need a macro because I'm learning C and this is an exercise i found and i couldn't solve it myself. i know i can use function to make it easily... but i want to know how to do it with macros. Thanks!

    Read the article

  • running a macro from an add-in

    - by every_answer_gets_a_point
    i have an add-in called book1. inside the addin there is a module called module1 which has a sub called addin1 i would like to run the macro addin1 from a different workbook i am trying to call this macro like this: Call Addin1 but that's not working and i tried: Call book1.xlam.Module1.AddIn1 which is not working either does anyone know how to run a macro that is within an add-in ?

    Read the article

  • Script/ Macro in Excel, by clicking on a cell

    - by Noob Doob
    There's something I want to do in Excel 2010. Specifically, I want to be able to make the open sheet load data from a text file, by clicking -important- on a cell of the current open worksheet. So my specific needs are: If it is possible in some way, to start a macro/script by clicking on a cell. About the script/macro: What would be the preferable, by your opinion, way of implementation. And more specifically, how to automatically import the data needed, only by clicking, without having to continually specify the desirable .txt file each time, only 1 time at max, at start or by using a custom "initalization/configuration" file.

    Read the article

  • Macro name being changed in Excel

    - by Brian Hooper
    I am creating VBA macros in my Excel spreadsheet. I notice that from time to time (after saving the spreadsheet and reopening it, usually) one or more of the macro names is being changed from sheet1.macroname to spreadsheetname.xls!macroname. This isn't a valid macro name so I can no longer run it. I can fix the problem by deleting all the macros, saving the result, pasting the macros back in again and saving again, but one can't expect normal users to do that. Does anyone know what is causing this, and what I can do to prevent it?

    Read the article

  • Excel 2010 VBA on-start macro execution - Error

    - by Noob Doob
    I have been trying to create a macro to be executed every time I open the document. I tried to use the Open event, but it does not seem to be working. The code is below: Private Sub Workbook_Open() Cells(3, 1) = "WOWWW" End Sub (It might seem ridiculous but I am trying to make any chunk of code to work, to move further with the start-time macro). Each time I open the file, the cell (A3) does not seem to be changing. Any ideas on this? I don't know if it matters, but I don't open the file directly. I open it through opening the Excel program and then File Tab - Open - File. That is because I have a problem if I open the file directly, which is another matter.

    Read the article

  • Can I append to a preprocessor macro?

    - by JCSalomon
    Is there any way in standard C—or with GNU extensions—to append stuff to a macro definition? E.g., given a macro defined as #define quux_list X(foo) X(bar) can I append X(bas) so that it now expands as if I’d defined it #define quux_list X(foo) X(bar) X(bas)? I’m playing with discriminated/tagged unions along these lines: struct quux_foo { int x; }; struct quux_bar { char *s; }; struct quux_bas { void *p; }; enum quux_type {quux_foo, quux_bar, quux_bas}; struct quux { enum quux_type type; union { struct quux_foo foo; struct quux_bar bar; struct quux_bas bas; } t; }; I figure this is a good place for the X-macro. If I define a macro #define quux_table X(foo) X(bar) X(bas) the enumeration & structure can be defined thus, and never get out of sync: #define X(t) quux_ ## t, enum quux_type {quux_table}; #undef X #define X(t) struct quux_ ## t t; struct quux { enum quux_type type; union {quux_table} t; }; #undef X Of course, the quux_* structures can get out of sync, so I’d like to do something like this, only legally: struct quux_foo { int x; }; #define quux_table quux_table X(foo) struct quux_bar { char *s; }; #define quux_table quux_table X(bar) struct quux_bas { void *p; }; #define quux_table quux_table X(bas) (Well, what I really want to be able to do is something like member_struct(quux, foo) { int x; }; but I’m well aware that macros cannot be (re)defined from within macros.) Anyhow, that’s my motivating example. Is there a way to accomplish this? Boost.Preprocessor examples are fine, if you can show me how to make the X-macro technique work with that library.

    Read the article

  • How to use a Macro command button in mac excel 2011

    - by user21255
    Im using Mac excel 2011 and I can't seem to get Macro to work. What I am trying to do is that in Worksheet (1st) I am trying to get all of the data entered in the Cases Table at the bottom to all be automatically inserted into the table in the "Cases" worksheet when I click on the "Update" button. But instead I keep getting a pop up saying runtime error and then it asks if I want to End, debug or something else. I just don't know if it is because I am not using Mac Excel correctly as I am used to using windows because I believe my code is correct in the VBA editor to get the button working. Anone who is able to use Mac excel 11 can they check to see if they can use the file provided to see i the button works? If anyone has windows excel then please feel free to check to see if it works on there as well. If it is a coding problem then can you please let me know. My question is simply how to run and stop a Macro in Mac excel 2011. The file can be accessed below: http://ge.tt/76qNwIx/v/0 Thanks

    Read the article

  • Prevent 'Run-time error '7' out of memory' error in Excel when using macro

    - by MasterJedi
    I keep getting this error whenever I run a macro in my excel file. Is there any way I can prevent this? My code is below. Debugging highlights the following line as the issue: ActiveSheet.Shapes.SelectAll My macro: Private Sub Save() Dim sh As Worksheet ActiveWorkbook.Sheets("Report").Copy 'Create new workbook with Sheets("Report"(2)) as only sheet. Set sh = ActiveWorkbook.Sheets(1) 'Set the new sheet to a variable. New workbook is now active workbook. sh.Name = sh.Range("B9") & "_" & Format(Date, "mmyyyy") 'Rename the new sheet to B9 value + date. With sh.UsedRange.Cells .Value = .Value 'eliminate all formulas .Validation.Delete 'remove all validation .FormatConditions.Delete 'remove all conditional formatting ActiveSheet.Buttons.Delete ActiveSheet.Shapes.SelectAll Selection.Delete lrow = Range("I" & Rows.Count).End(xlUp).Row 'select rows from bottom up to last containing data in column I Rows(lrow + 1 & ":" & Rows.Count).Delete 'delete rows with no data in column I Application.ScreenUpdating = False .Range("A410:XFD1048576").Delete Shift:=xlUp 'delete all cells outwith report range Application.ScreenUpdating = True Dim counter Dim nameCount nameCount = ActiveWorkbook.Names.Count counter = nameCount Do While counter > 0 ActiveWorkbook.Names(counter).Delete counter = counter - 1 Loop 'remove named ranges from workbook End With ActiveWorkbook.SaveAs "\\Marko\Report\" & sh.Name & ".xlsx" 'Save new workbook using same name as new sheet. ActiveWorkbook.Close False 'Close the new workbook. MsgBox ("Export complete. Choose the next ADP in cell B9 and click 'Calculate'.") 'Display message box to inform user that report has been saved. End Sub Not sure how to make this more efficient or to prevent this error.

    Read the article

  • How to bind "rest" variables to list of values in macro in Scheme

    - by Slartibartfast
    I want to make a helper macro for writing match-extensions. I have something like this: (define-match-expander my-expander (? (stx) (let* ([dat (cdr (syntax-e stx))] [var1 (car dat))] [var2 (cadr dat)]) ;transformer goes here ))) So I wanted a macro that will do this let binding. I've started with something like this: (define-syntax-rule (define-my-expander (id vars ...) body) (define-match-expander id (? (stx) (match-let ([(vars ...) (cdr (syntax-e stx))]) body)))) but match-let isn't defined in transformation time. First question would be is there any other way of doing this (making this expanders, I mean)? Maybe there is already something similar in plt-scheme that I'm not aware of, or I'm doing it wrong in some way. Regardless of answer on the first question, if I ever want to bound list of variables to list of values inside of a macro, how should I do it? EDIT: In combination with Eli's answer macro now looks like this: (define-syntax-rule (define-my-expander (id vars ...) body) (define-match-expander id (? (stx) (syntax-case stx () [(_ vars ...) body]))))

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >