Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Sorting specific data from one sheet to another

Maybe this will help.

Sub GESACC()
Dim rng As Range, cell As Range
Dim i As Long, sh As Worksheet

With Worksheets("All Records")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
i = 1

Set sh = Worksheets("GESACard")
For Each cell In rng
If UCase(Trim(cell.Value)) = "4-$" Or _
UCase(Trim(cell.Value)) = "CNO-$" Then
If UCase(Trim(cell.Offset(0, 1).Value)) = _
"GESA CC" Then
cell.EntireRow.Copy sh.Cells(i, 1)
i = i + 1
End If
End If
Next
End Sub
--
Mike Q.


"JOUIOUI" wrote:

I'm copying data from a sheet called "All Records" and pasting the results in
another sheet in the same workbook called "GESACard". I want to copy any
rows that have "4-$" Or "CNO-$" in column 1 and "GESA CC" in column 2. This
code is not working for me, it is something to do with the "4-$" Or "CNO-$" I
think. Any help you can provide is appreciated. Thank you

Sub CopyDataGESACard()

' Create GESA CC Matching Report

Dim rng As Range, cell As Range
Dim i As Long, sh As Worksheet
With Worksheets("All Records")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
i = 1

Set sh = Worksheets("GESACard")
For Each cell In rng
If UCase(Trim(cell.Value)) = "4-$" Or "CNO-$" And _
UCase(Trim(cell.Offset( _
0, 1).Value)) = "GESA CC" Then
cell.EntireRow.Copy sh.Cells(i, 1)
i = i + 1
End If
Next
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a new sheet from specific data in existing sheet Rosscoe Excel Discussion (Misc queries) 2 January 13th 10 03:07 PM
Showing Specific Data from Master Sheet to Another Sheet Parker Jones New Users to Excel 1 July 10th 09 02:01 AM
How to Automatically transfer specific Data from Sheet 1 to Sheet Jman Excel Worksheet Functions 12 May 10th 07 05:35 AM
Copying Data from one sheet to another sheet on a specific day Gav123 Excel Worksheet Functions 0 May 1st 07 10:17 AM
SORTING DATA TO ANOTHER SHEET cityfc Excel Worksheet Functions 0 January 11th 06 11:40 PM


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"