ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros will not work when sheet e-mailed (https://www.excelbanter.com/excel-programming/427844-re-macros-will-not-work-when-sheet-e-mailed.html)

joel

Macros will not work when sheet e-mailed
 
You should specify the worksheet and workbook to make sure it works. If this
code is part of worksheet change you don't need the sheet name.

with thisworkbook.sheets("Sheet1")
.Rows("36:36").Insert Shift:=xlDown
.Range("A36:G36").Interior.ColorIndex = xlNone
.Rows("36:36").RowHeight = 17.25
.Range("B20").Copy _
destination:=.Range("A36")
end with


"Ber" wrote:

I have created macros stored in all open workbooks and they work perfectly
but when I e-mail the workbook it will not work for other users, if they
access it or copy it from a common folder it works for them but I need to
e-mail it to multiple users. they are getting run time error '1004' Insert
method of range class failed and when I debug the line that fails in each
macro is
Selection.Insert Shift:=xlDown Help please I am not good at VBA code is
below

Rows("36:36").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=9
Range("A36:G36").Select
Selection.Interior.ColorIndex = xlNone
Rows("36:36").RowHeight = 17.25
Range("A36").Select
ActiveWindow.SmallScroll Down:=-15
Range("B20").Select
Selection.Copy
Range("A36").Select
ActiveSheet.Paste
Range("B36").Select
Application.CutCopyMode = False
End Sub



All times are GMT +1. The time now is 10:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com