Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Paste from Array to a Row

I found this code but it pastes in Column A. Can someone advise how I can
paste to the last row +1

With Worksheets("Data")
Set NextCell = .Cells(.Rows.count, "A").End(xlUp).Offset(1, 0)
End With

NextCell.Resize(UBound(vBOD) - LBound(vBOD) + 1, 1).Value =
Application.Transpose(vBOD)

Tks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Paste from Array to a Row

That pastes in column A in the last row used in column A. Are you saying
that some other column needs to be used to determine the last used row, but
you want the data pasted in that row in column A?

You can use this function

Function LastRow(rng1 as Range) As Range
Dim rng As Range
Set rng = rng1.Parent.Cells.Find(What:="*", _
After:=rng1.parent.Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
If Not rng Is Nothing Then
Set LastRow = rng.EntireRow
Else
Set LastRow = Noting
End If
End Function


then in your code

With Worksheets("Data")
Set NextCell = .Cells(LastRow(.Cells(1,1)).Row,1)
End With

--
Regards,
Tom Ogilvy


"Dale" wrote:

I found this code but it pastes in Column A. Can someone advise how I can
paste to the last row +1

With Worksheets("Data")
Set NextCell = .Cells(.Rows.count, "A").End(xlUp).Offset(1, 0)
End With

NextCell.Resize(UBound(vBOD) - LBound(vBOD) + 1, 1).Value =
Application.Transpose(vBOD)

Tks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Paste from Array to a Row

Sorry, yes finding the last row used in column A is fine what I was hoping to
be able to do is paste from array vBOD(1) to ARow() then vBOD(2) BRow() etc.

Tks Dale

"Tom Ogilvy" wrote:

That pastes in column A in the last row used in column A. Are you saying
that some other column needs to be used to determine the last used row, but
you want the data pasted in that row in column A?

You can use this function

Function LastRow(rng1 as Range) As Range
Dim rng As Range
Set rng = rng1.Parent.Cells.Find(What:="*", _
After:=rng1.parent.Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
If Not rng Is Nothing Then
Set LastRow = rng.EntireRow
Else
Set LastRow = Noting
End If
End Function


then in your code

With Worksheets("Data")
Set NextCell = .Cells(LastRow(.Cells(1,1)).Row,1)
End With

--
Regards,
Tom Ogilvy


"Dale" wrote:

I found this code but it pastes in Column A. Can someone advise how I can
paste to the last row +1

With Worksheets("Data")
Set NextCell = .Cells(.Rows.count, "A").End(xlUp).Offset(1, 0)
End With

NextCell.Resize(UBound(vBOD) - LBound(vBOD) + 1, 1).Value =
Application.Transpose(vBOD)

Tks

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
Paste Array Jeff Excel Discussion (Misc queries) 1 September 28th 06 06:48 PM
Excel VBA, Loop, array, cut and paste [email protected] Excel Programming 1 September 23rd 05 06:40 PM
Paste Array into worksheet Kaval Excel Programming 1 August 11th 05 09:18 AM
Need help to Copy and Paste array using macro wira Excel Programming 4 May 11th 05 08:39 AM
lookup array and paste value sammberg Excel Programming 0 September 24th 03 12:14 AM


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

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

About Us

"It's about Microsoft Excel"