I have a problem, i cant get my head round. I have a sheet "Daily"
and i want to copy the data from there to another sheet "4 week
stock" At the top of the Daily sheet is the day and week number,
these 2 cells are combined into one cell eg Mon,1 for data that is
added Monday of week 1. I then want my excel spreadsheet to reconise
that the data in cells D5:G5 need to be copied, transposed and
pasted in the corresponding column in "4 week stock" that refers to
Mon,1
I have at the moment got, the following code, which will do it right
for Mon,1 but nothing else. I can email copy of spreadsheet if
required
Sub TRANSFEROFINFO1()
'Attempt at copying info from one sheet to another Macro recorded
6/6/2006 by CarmenN
Dim LDate As String
Dim LColumn As Integer
Dim LFound As Boolean
On Error GoTo Err_Execute
'Retrieve date value to search for
LDate = Sheets("Daily").Range("e2").Value
Sheets("4 Week Stock").Select
'Start at Column C
LColumn = 3
LFound = False
While LFound = False
'Encountered blank cell in row 3, terminate search
If Len(Cells(3, LColumn)) = 0 Then
MsgBox "No matching date was found"
Exit Sub
'Found match in row 3
ElseIf Cells(3, LColumn) = LDate Then
Sheets("Daily").Select
Range("I6:L6").Select
Selection.Copy
Sheets("4 Week stock").Select
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Sheets("Daily").Select
Range("I7:L7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("4 Week stock").Select
Range("C16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Sheets("Daily").Select
LFound = True
MsgBox "The data has been successfully copied"
'Continue searching
Else
LColumn = LColumn + 1
End If
Wend
On Error GoTo 0
Exit Sub
Err_Execute:
MsgBox "An error occurred."
End Sub