Coding issue

seahawk56

New Member
Joined
Jun 23, 2008
Messages
30
I have created a template that has a macro that pulls data from a spread sheet (Monday) and pastes in another spread sheet (Prodweek). When I adjust the template to be updated for a new week. I just do the find and replace with the name (Prodweek) and the date span of the week. I am by no means efficient in Visual Basic but I feel comfortable doing the find and replace function. But the problem is that a few people will be using this that are not very versed in Visual Basic. So there is some concern they might mess things up or feel overwhelmed messing around in there. I have a friend that was telling me he has seen before where by entering in the desired name (name of the new spread sheet) in a cell that it will adjust the coding to the new name. We were trying to figure it out but could not get it to work. Below I'm pasting the code that we have so far. If anyone could please help out it would be greatly appreciated.
Thank you,
Seahawk56

Option Explicit
Const sheetname1 = "KaizenBoard"
Dim Prodweek As String

Sub MondayProd()
'
' MondayProd Macro
' Macro recorded 9/20/2008 by whitjh1
'
Prodweek = Trim(Sheets(sheetname1).Cells(2, 1).Value)
Workbooks.Open Filename:= _
"G:\ROC-CLAIMS\Clms Proc-Model Line\POSKaizenReports\Production Results\Monday.xls"
Sheets("Data").Select
Selection.ClearContents
Selection.QueryTable.Delete
Application.Run "Monday.xls!Prod"
Sheets("Daily Prod").Select
Range("B2:B25").Select
Selection.Copy
Windows(Prodweek & ".xls").Activate
ActiveWindow.SmallScroll Down:=-12
Range("BS3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Monday.xls").Activate
ActiveWindow.SmallScroll Down:=-27
Range("D2:E25").Select
Application.CutCopyMode = False
Selection.Copy
Windows(Prodweek & ".xls").Activate
ActiveWindow.SmallScroll Down:=-9
Range("BW3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Monday.xls").Activate
ActiveWindow.SmallScroll Down:=-21
Range("H2:H3").Select
Application.CutCopyMode = False
Selection.Copy
Windows(Prodweek & ".xls").Activate
Sheets("Kaizen Board").Select
Range("B22").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub

 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,215,501
Messages
6,125,169
Members
449,212
Latest member
kenmaldonado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top