LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Next Cell Empty Issues

Here is the code I have now, and what I need it to do.

Sub Data_Extract()
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim WS3 As Worksheet
Dim WS4 As Worksheet

Dim rng1 As Range
Dim rng2 As Range

Dim Str As String

Set WS1 = Sheets("Summary")
Set WS2 = Sheets("Credits")
Set WS3 = Sheets("Payroll")
Set WS4 = Sheets("Macros")


WS3.Select
Range("A5:AA1500").Select
Selection.Copy
WS4.Select
Range("A1").Select
ActiveSheet.Paste

Do Until IsEmpty(ActiveCell)
Set rng1 = WS4.Range("A2:AA1497").CurrentRegion
Str = WS4.Range("C2").Value
WS4.Select
WS4.AutoFilterMode = Flase
rng1.AutoFilter Field:=3, Criteria:=Str
WIth WS4.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1,0).Resize(.Rows.Count - 1, .Columns.Count)
..SpecialCells (xlCellTypeVariable)


'HERE IS WHERE I NEED HELP!!!!!
WS2.Select
Range("K5").Select 'Data Field to Copy
Selection.Copy
WS1.Select
Range("A8").Select 'First Cell on sheet where data needs to go
' I need this to look for the next blank cell on the page and then paste the
value of
' The Data Field to Copy there.
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
'Then on the same Row I need it to do the following....
'If value of cell AV9=AX3 on WS2 it needs to copy value from WS2 cell AV70 to
'the same row in colum B.
'END HELP NEEDED SECTION !!!!


WS2.Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
WS2.Select
Range("A10:AA69").ClearContents
If Not rng2 Is Nothing Then
rng2.Copy WS2.Range("A1" & LastRow(WS2) + 0)
rng2.EntireRow.Delete
End If
End With
WS4.AutoFilterMode = False
WS4.Select
Range("C2").Activate
Loop
End Sub


Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", After:=sh.Range("A6:AA1497"),
LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious,
MatchCase:=False).Row
On Error GoTo 0
End Function
 
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
IF function issues w/ empty cells Bri Excel Worksheet Functions 2 January 1st 09 09:22 PM
Leaving an empty cell empty GRL Excel Discussion (Misc queries) 4 April 22nd 06 05:47 PM
why a reference to an empty cell is not considered empty Nicoscot Excel Discussion (Misc queries) 10 March 10th 06 05:36 AM
Finding next empty empty cell in a range of columns UncleBun Excel Programming 1 January 13th 06 11:22 PM
Empty cell and a the empty String JE McGimpsey Excel Programming 0 September 13th 04 04:12 PM


All times are GMT +1. The time now is 02:37 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"