I have some code that works as follows:
When the user clicks a command button, a calculation is done to find the currentwk and based on the results of this calculation it selects the required range and places a border around that range. Then selects the first cell in this selected range so that the user can enter data.
This is the code:
The data that is entered in the selected range above, has to be copied to a summary sheet (see file attached). For instance, if Range("G20:AS34") on the 12-Week Forecast sheet is the selected range where data is entered, in week 29, there will be entries for:Dim CurrentWk As Integer Dim Age As Integer Dim r As Integer Dim c As Range Dim FindWk 'Unprotect Sheet Sheets("12-Week Forecast").Unprotect 'Go to 12-Week Forecast sheet Sheets("12-Week Forecast").Select ActiveSheet.Range("G3").Select Age = 13 'Calculate Current Week CurrentWk = ActiveSheet.Range("G3").Value - Age 'Get Final Row r = Cells(Rows.Count, 1).End(xlUp).Row Set FindWk = Range("A5:A" & r).Find(CurrentWk, LookIn:=xlValues, lookat:=xlWhole) If Not FindWk Is Nothing Then 'Range(FindWk.Offset(0, 0), FindWk.Offset(14, 0)).Select Range(FindWk.Offset(0, 6), FindWk.Offset(14, 44)).Select 'Selection.Copy 'Selection.Interior.ColorIndex = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlHairline 'xlMedium End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlHairline 'xlMedium End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlHairline 'xlMedium End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlHairline 'xlMedium End With Range(FindWk.Offset(0, 6), FindWk.Offset(0, 6)).Select ActiveWindow.FreezePanes = True frmInputMenu.Hide End If 'Protect Sheet Sheets("12-Week Forecast").Protect
Age, Available Fraction, Forecast
13, 0.2, 13,
12, 0.6, 40.2,
11, 0.2, 12,
10, 0.1, 11.2,
9, 0.1, 6.2,
At the press of the update button, i want the values in the forecast column to be pasted in the 12-Week Summary sheet under the week 29 column.
Note that because the range is based on a calculation, this range varies. Can anyone assist?
Last edited by Suety; 09-30-2010 at 02:01 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks