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: 13
Default Advice on simple mod Req

Hi all, I obtained this code after doing some research but I am not
quite there yet. Would appreciate some ideas on how I can mod this code
to populate columns "A to F" only on the "Order" sheet.

Thanks,
Dean


Public Sub CopyToAnotherSheet()
Dim rCell As Excel.Range
Dim rRow As Excel.Range
Dim wksFound As Excel.Worksheet
Dim wksData As Excel.Worksheet

Dim szLookupVal As String
Dim szRowAddy As String

Dim Lrow As Long


Set wksFound = Sheets("Order") 'Sheet that gets the copied data
Set wksData = Sheets("Database") 'Sheet that contains the data to
search


Lrow = wksFound.Cells(Rows.Count, 1).End(xlUp).Row + 1
If IsEmpty(wksFound.Cells(1, 1)) And Lrow = 2 Then Lrow = 1

szLookupVal = InputBox("Type The APN Number Here Then Press ENTER or
OK", "APN Search", "")
If Len(szLookupVal) = 0 Then Exit Sub

With wksData.Cells

Set rCell = .Find(szLookupVal, , , , , False)
If Not rCell Is Nothing Then

szRowAddy = rCell.Address

Set rRow = rCell

Do

Set rCell = .FindNext(rCell)

Set rRow = Application.Union(rRow, rCell)

rRow.EntireRow.Copy wksFound.Cells(Lrow, 1)

Loop While Not rCell Is Nothing And rCell.Address < szRowAddy

End If
End With

Set rCell = Nothing
Set rRow = Nothing
Set wksFound = Nothing
Set wksData = Nothing
MsgBox "Item Sent to Order Page"
End Sub

 
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
need advice Sergo Excel Programming 1 February 5th 06 12:52 AM
Advice Please Greg B Excel Worksheet Functions 5 March 17th 05 12:13 PM
Almost got it !! but need advice Nospam Excel Worksheet Functions 6 February 28th 05 10:27 AM
Advice please Greg New Users to Excel 2 February 24th 05 12:19 PM
RTD Advice JD Excel Programming 2 October 22nd 04 11:29 AM


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