Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to activate Add-ins for files in a particular folder????

Hi ive got the following code running manually on a spreadsheet. But I need
it to run automatically only when the macro is in a particular folder. Need
any suggestions or ways to improve my code..thank you in advance!!..

Sub main()

call Hide_cols()
call Format_cols()
call Filter_sm()
call Page_setup()

end sub

Sub Hide_cols()

Dim i As Integer

For i = 26 To 1 Step -1
If (i < 2) And (i < 3) And (i < 5) And (i < 6) And (i < 9) And (i <
15) And (i < 24) Then
Columns(i).Select
Selection.EntireColumn.Hidden = True
End If
Next i

End Sub

Sub Format_cols()

Cells(1, "X").Value = "SsC"
Cells(1, "O").Value = "SL"
Cells(1, "E").Value = "AWS"
Cells(1, "I").Value = "BOH"
Cells(1, "AA").Value = "Pickbin"
Cells(1, "AB").Value = "SGF"
Cells(1, "AC").Value = "Diff+/-"
Range("E1:AC1").HorizontalAlignment = xlHAlignCenter
Cells(1, "AC").Font.Bold = True


With Worksheets("Data")
.Columns("O:O").Select
Selection.NumberFormat = "00-00-00"
.Columns("B").AutoFit
.Columns("E").AutoFit
.Columns("O").AutoFit
.Columns("X").AutoFit
.Columns("I").AutoFit
.Columns("AA:AC").ColumnWidth = 9
.Columns("C").ColumnWidth = 39.3
End With

End Sub

Sub Filter_SM()

Columns("F").AutoFilter Field:=1, Criteria1:="=2"
Columns("F").Select
Selection.EntireColumn.Hidden = True

End Sub

Sub Page_Setup()

With Worksheets("Data").PageSetup
.LeftHeader = "&""Arial,Bold""IKEA Confidential"
.CenterHeader = Format(Now(), "mmmm dd, yyyy")
.LeftFooter = "Audit Commenced By:_______________________"
.RightFooter = "Audit Verified By:_______________________"
.RightHeader = "page &p"
.CenterHorizontally = True
.Zoom = 125
.Orientation = xlLandscape
.PrintGridlines = True
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(0.51)
.BottomMargin = Application.InchesToPoints(0.35)
.HeaderMargin = Application.InchesToPoints(0.2)
.FooterMargin = Application.InchesToPoints(0.11)
.PrintTitleRows = "$1:$1"

End With

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default How to activate Add-ins for files in a particular folder????

have you tried saving the workbook with the codes as an add-in?
I have heard, when you do, then you can access your macro from any
worksheet.
I haven't worked on it too much, I do know that once I acccidently save
a workbook as an add-in, and ofeter that when ever I went into visual
basics, that darn macro was there, it took me a long time to realize
that I could just deselect it by going to tools,addins and unchecking
it, so I assume you could do the same thing
Andy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to activate Add-ins for files in a particular folder????

Sub main()

if lcase(ThisWorkbook.Path) = lcase("c:\my folder\my subfolder") then
call Hide_cols()
call Format_cols()
call Filter_sm()
call Page_setup()
End if
end sub

--
Regards,
Tom Ogilvy


"kewlrunnings" wrote in message
...
Hi ive got the following code running manually on a spreadsheet. But I

need
it to run automatically only when the macro is in a particular folder.

Need
any suggestions or ways to improve my code..thank you in advance!!..

Sub main()

call Hide_cols()
call Format_cols()
call Filter_sm()
call Page_setup()

end sub

Sub Hide_cols()

Dim i As Integer

For i = 26 To 1 Step -1
If (i < 2) And (i < 3) And (i < 5) And (i < 6) And (i < 9) And (i <
15) And (i < 24) Then
Columns(i).Select
Selection.EntireColumn.Hidden = True
End If
Next i

End Sub

Sub Format_cols()

Cells(1, "X").Value = "SsC"
Cells(1, "O").Value = "SL"
Cells(1, "E").Value = "AWS"
Cells(1, "I").Value = "BOH"
Cells(1, "AA").Value = "Pickbin"
Cells(1, "AB").Value = "SGF"
Cells(1, "AC").Value = "Diff+/-"
Range("E1:AC1").HorizontalAlignment = xlHAlignCenter
Cells(1, "AC").Font.Bold = True


With Worksheets("Data")
.Columns("O:O").Select
Selection.NumberFormat = "00-00-00"
.Columns("B").AutoFit
.Columns("E").AutoFit
.Columns("O").AutoFit
.Columns("X").AutoFit
.Columns("I").AutoFit
.Columns("AA:AC").ColumnWidth = 9
.Columns("C").ColumnWidth = 39.3
End With

End Sub

Sub Filter_SM()

Columns("F").AutoFilter Field:=1, Criteria1:="=2"
Columns("F").Select
Selection.EntireColumn.Hidden = True

End Sub

Sub Page_Setup()

With Worksheets("Data").PageSetup
.LeftHeader = "&""Arial,Bold""IKEA Confidential"
.CenterHeader = Format(Now(), "mmmm dd, yyyy")
.LeftFooter = "Audit Commenced By:_______________________"
.RightFooter = "Audit Verified By:_______________________"
.RightHeader = "page &p"
.CenterHorizontally = True
.Zoom = 125
.Orientation = xlLandscape
.PrintGridlines = True
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(0.51)
.BottomMargin = Application.InchesToPoints(0.35)
.HeaderMargin = Application.InchesToPoints(0.2)
.FooterMargin = Application.InchesToPoints(0.11)
.PrintTitleRows = "$1:$1"

End With

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
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
Copying all files in a folder to new folder michaelberrier Excel Discussion (Misc queries) 2 June 20th 06 05:35 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM
How to copy 30 csv files from a folder to another folder ddiicc Excel Programming 1 July 17th 05 09:42 AM


All times are GMT +1. The time now is 01:19 PM.

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

About Us

"It's about Microsoft Excel"