Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all.
I have a module with the following code snippet I have been trying to modify: Set wksPasteTo = Sheets("Closed_Requests") Sheets("Closed_Requests").Select 'ActiveSheet.Unprotect pw LR = Range("B" & Rows.Count).End(xlUp).Row Set rngPasteTo = wksPasteTo.Range("A" & (LR + 1)) Sheets("Distribution").Select LastRow = Range("A65536").End(xlUp).Row With Sheets("Distribution") For x = LastRow To 1 Step -1 If Range("B" & x).Value = "Closed" Then Range("B" & x).EntireRow.Copy With Sheets("Closed_Requests") wksPasteTo.Paste rngPasteTo Set rngPasteTo = rngPasteTo.Offset(1) End With Sheets("Distribution").Range("B" & x).EntireRow.Delete End If Next x End With I have seen several posts that use: Sheets("Sheet1").Cells.SpecialCells(xlTextValues). EntireRow.Copy Sheets("Sheet2").Cells.PasteSpecial Paste:=xlPasteValues but I have been unable to figure out how to merge the above with my code. There is one column 'B' that contains a color that I want to copy with the data, but all the rest of the combo boxes and code need to be stripped from the copied rows. I have another module with the following different code snippet that I need to copy and paste as above: 'create temporary worksheet Set AllName1 = Worksheets.Add(After:=Sheets(Sheets.Count)) AllName1.Name = frmALL.AllName.Value Set ws2 = ActiveSheet ws2.Range("A1:" & colName & 1).Value = ws1.Range("A1:" & colName & 13).Value With ws1 .Range("A2:" & colName & 1).Copy With ws2.Range("A3:" & colName & 1) ActiveSheet.Paste .RowHeight = 12 Range("A3").Select End With 'compares and copies data With Source LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row For x = 2 To LastRow If IsDate(.Cells(x, "C").Value) And .Cells(x, "C").Value < "" And ..Cells(x, "C").Value = lodate And .Cells(x, "C").Value <= hidate Then If RowsWithNumbers Is Nothing Then Set RowsWithNumbers = .Cells(x, "C") Else Set RowsWithNumbers = Union(RowsWithNumbers, .Cells(x, "C")) End If End If Next If Not RowsWithNumbers Is Nothing Then 'copies matched data to temporary sheet named by user RowsWithNumbers.EntireRow.Copy AllName1.Range("A3") End If End With 'Clear old report Sheets("All_Report").Range("A3:J" & Rows.Count).Clear 'Filter data based on dates chosen LR = Range("A" & Rows.Count).End(xlUp).Row 'Copy data ranges With ws2 .Range("A3:G" & LR).SpecialCells(xlCellTypeVisible).Copy Sheets("All_Report").Range("A3") With ws2 .Range("J3:K" & LR).SpecialCells(xlCellTypeVisible).Copy Sheets("All_Report").Range("H3") With ws2 .Range("O3:O" & LR).SpecialCells(xlCellTypeVisible).Copy Sheets("All_Report").Range("J3") End With End With End With Any help with these would be greatly appreciated!!!! Thanks!!! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use loop to filter, copy/paste to new sheet; run through entire li | Excel Programming | |||
If Font.ColorIndex = 3, Copy Entire Row and Paste to New Sheet | Excel Programming | |||
Find Multiple Values, Copy Entire Row & Paste | Excel Programming | |||
Copy Paste Values - Entire Workbook and Save | Excel Discussion (Misc queries) | |||
Macro - copy entire row and paste at bottom of another sheet | Excel Programming |