Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GMc GMc is offline
external usenet poster
 
Posts: 8
Default Macro not working in Addin


Hi,
I have some code that works fine when added into a module within a workbook.
However, as i want to ensure all users are able to use it i have created an
add-in (xlam). Toolbars created using xml.
When i attempt to execute the macro i receive the message "wrong number of
arguments or inavlid property assignment".
My code is as follows:
Sub fmat
Dim c1 As Range
Dim c2 As Range
Dim lnLastRow As Long

Application.ScreenUpdating = False

With ActiveSheet
Columns("E:E").ColumnWidth = 40
Range("A:A,C:C,F:J,L:L").Delete
..UsedRange
lnLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set bglc1 = .Range("A1", .Cells(lnLastRow, "A"))
c1.AutoFilter Field:=1, Criteria1:="="
c1.SpecialCells(xlCellTypeVisible).EntireRow.Delet e

Set c2 = .Range("A1", .Cells(lnLastRow, "A"))
c2.AutoFilter Field:=1, Criteria1:="Last Year"
c2.SpecialCells(xlCellTypeVisible).EntireRow.Delet e
..Rows("1:1").Insert Shift:=xlDown
..Range("A1:D1").Value = Array("Last Year", "Account", "Account Name",
"Balance")
..UsedRange
End With

Columns("E:E").Copy
Columns("D:D").PasteSpecial Paste:=xlPasteValues, Operation:=xlSubtract, _
SkipBlanks:=False, Transpose:=False
Range("E:E").Delete
Application.ScreenUpdating = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Macro not working in Addin


Not sure if this is your problem, but you are not fully referencing your
assignments.

When using "With ActiveSheet" all references need to be preceded with a
period (.)




--

Regards,
Nigel




"GMC" wrote in message
...
Hi,
I have some code that works fine when added into a module within a
workbook.
However, as i want to ensure all users are able to use it i have created
an
add-in (xlam). Toolbars created using xml.
When i attempt to execute the macro i receive the message "wrong number of
arguments or inavlid property assignment".
My code is as follows:
Sub fmat
Dim c1 As Range
Dim c2 As Range
Dim lnLastRow As Long

Application.ScreenUpdating = False

With ActiveSheet
Columns("E:E").ColumnWidth = 40
Range("A:A,C:C,F:J,L:L").Delete
.UsedRange
lnLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set bglc1 = .Range("A1", .Cells(lnLastRow, "A"))
c1.AutoFilter Field:=1, Criteria1:="="
c1.SpecialCells(xlCellTypeVisible).EntireRow.Delet e

Set c2 = .Range("A1", .Cells(lnLastRow, "A"))
c2.AutoFilter Field:=1, Criteria1:="Last Year"
c2.SpecialCells(xlCellTypeVisible).EntireRow.Delet e
.Rows("1:1").Insert Shift:=xlDown
.Range("A1:D1").Value = Array("Last Year", "Account", "Account Name",
"Balance")
.UsedRange
End With

Columns("E:E").Copy
Columns("D:D").PasteSpecial Paste:=xlPasteValues, Operation:=xlSubtract, _
SkipBlanks:=False, Transpose:=False
Range("E:E").Delete
Application.ScreenUpdating = True
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AddIn Analysis Pak not working anymore rexie3 Excel Worksheet Functions 2 September 6th 07 11:36 PM
addin not working properly Kanan Excel Programming 0 March 28th 07 01:17 AM
Addin close command not working in new workbook stewdizzle Excel Programming 3 January 6th 07 09:27 PM
AddIn not working right dbjk Excel Discussion (Misc queries) 2 August 12th 05 07:31 AM
Addin working on all sheets Rune Pedersen Excel Programming 1 August 31st 04 02:45 PM


All times are GMT +1. The time now is 04:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"