Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Resize to last entry in row and copy to sheet 1

The commented out line is giving me fits.
The MsgBox line is correct but I'm muddled on making the resize/copy work.

Thanks,
Howard

Sub MeFindIt()
Dim rngFound As Range
Dim myFnd As String
myFnd = Sheets("Sheet1").Range("B2")
Set rngFound = Sheets("Sheet2").Range("B:B").Find(What:=myFnd, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If Not rngFound Is Nothing Then

'rngFound.Offset(, 1).Resize.Cells(1, Columns.Count).End(xlToLeft).Column.Copy Sheets("Sheet1").Range("C2")

MsgBox "Match for " & """" & myFnd & """" & " in cell " & rngFound.Address

Else
MsgBox "No match found. "
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Resize to last entry in row and copy to sheet 1

The commented out line is giving me fits.
The MsgBox line is correct but I'm muddled on making the resize/copy
work.

Thanks,
Howard

Sub MeFindIt()
Dim rngFound As Range
Dim myFnd As String
myFnd = Sheets("Sheet1").Range("B2")
Set rngFound = Sheets("Sheet2").Range("B:B").Find(What:=myFnd, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows,
_
SearchDirection:=xlNext, _
MatchCase:=False)

If Not rngFound Is Nothing Then

'rngFound.Offset(, 1).Resize.Cells(1,
Columns.Count).End(xlToLeft).Column.Copy Sheets("Sheet1").Range("C2")

MsgBox "Match for " & """" & myFnd & """" & " in cell " &
rngFound.Address

Else
MsgBox "No match found. "
End If
End Sub


You're missing the row/col args for Resize()!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Resize to last entry in row and copy to sheet 1




You're missing the row/col args for Resize()!



--

Garry


Could not see the forest for the trees!

rngFound.Offset(, 1).Resize(1, Cells(1, Columns.Count).End(xlToLeft).Column).Copy _
Sheets("Sheet1").Range("C2")This does it.

Thanks, Garry.

Howard
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Resize to last entry in row and copy to sheet 1

Could not see the forest for the trees!

Happens to the best of us!<g I've spent the last few days tweaking my
FileSystem.bas procedures and had to ask my more times than I'll admit
to.., "what was I thinking when I wrote this?" OR.., "who the hell
wrote this?"!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
Resize a row but copy but skip columns I don't want to copy Howard Excel Programming 6 August 30th 13 02:30 PM
copy data from one sheet to another "entry has to be same shape" des-sa[_2_] Excel Discussion (Misc queries) 3 July 26th 08 06:38 PM
Copy charts and resize Joe34 Excel Programming 0 March 27th 06 04:21 PM
resize and copy jer Excel Programming 2 January 14th 06 08:32 PM
copy cell after resize method in VBA norika Excel Programming 0 June 22nd 05 05:03 AM


All times are GMT +1. The time now is 09:45 AM.

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"