Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hello all,
I have a fairly simple code below that's missing one critical step. Currently, it wants to copy the data to the first blank column it finds in the target sheet. What I want to do is have it copy data to the column in the target sheet that matches the range in the source sheet. So, if the source sheet is identified as the "June" month column, I'd like the data to be copied to "June" month column in the target sheet. Can anyone help out....thanks, Steve Sub CopyDataToPlan() Dim LMonth As String Dim LRow As Integer Dim LFound As Boolean 'Retrieve date value to search for LDate = Sheets("Month & YTD vs. Budget").Range("E10").Value Sheets("Monthly Trend").Select 'Start at Row 15 LRow = 15 LFound = False While LFound = False 'Found match in row 15 If Cells(15, LRow) = LMonth Then 'Select values to copy from "Month & YTD vs. Budget" sheet Sheets("Month & YTD vs. Budget").Select Range("C20:C188").Select Selection.Copy 'Paste onto "Monthly Trend" sheet Sheets("Monthly Trend").Select Cells(17, LRow).Select Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False LFound = True MsgBox "The data has been successfully copied." 'Continue searching Else LRow = LRow + 1 End If Wend On Error GoTo 0 Exit Sub Err_Execute: MsgBox "An error occurred." End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Data from one sheet to many based on column A | Excel Programming | |||
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. | Excel Programming | |||
Copy rows to another sheet. Criteria = cells in column H is not em | Excel Programming | |||
copy to another sheet based on column value | Excel Programming | |||
Cut rows from one sheet into multiple sheets based on a criteria in first column | Excel Programming |