View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Richard ROV Richard ROV is offline
external usenet poster
 
Posts: 1
Default Find, Copy and Paste question

Hello

My goal is to copy information from one sheet to another, based upon a name
I select. This code does it, but what I would like to do is put the game
numbers in the first row and paste the copied information after. I have tried
and get an error about the cell is not big enough, and I should select a
larger area to paste into.

I have tried setting the range, and still get the error, how do I work
around this? trying the offset(0,1) gave me the same error. I now put the
game number into row twenty six, should I cut that and then insert it into
the a row?

Thanks,

Dim strPlayersName As String
'get the players name
strPlayersName = InputBox("Type in a players Name!", "Players SuperStats")
Dim intRow As Variant
Dim intRowA As Variant
Dim strName As String
Dim rngcurrent As Range
intRowA = 3

For i = 2 To Sheets.Count ' Provides a count of
all worksheets

Cells.Find(What:=strPlayersName, After:=ActiveCell,
LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
intRow = ActiveCell.Row
Rows(intRow).Select
Selection.Copy
strName = ActiveSheet.Name

Windows("Player Stats.xls").Activate
Rows(intRowA).Select
ActiveSheet.Paste

Cells(intRowA, 26).Value = strName
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
'.FontName = "Arial"
'.Size = "8"
End With
Cells(ActiveCell.Row + 1, ActiveCell.Column).Select
intRowA = ActiveCell.Row
Windows("Canucks 2005 Superstats BU.xls").Activate
Sheets(i).Select
Cells.FindNext(After:=ActiveCell).Activate
Rows(intRow).Select


Next

--
Peace,

Richard