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: 67
Default Returning to first offset point.

I Need some help please

If Cells(2, 4) = R.Cells(k).Value Then
ActiveCell.Select
ActiveCell.Offset(0, -2).Copy
R2.Select
ActiveCell.PasteSpecial
R.Select

the above code works only for the first cell of the range for exsample it
will find the info i need 10 cells down paste the frist part of the info
then in will go
back to the top of the range but i need it to paste all the info from the
same row.

I know it's because i have use R.select but im not sure how to fix it.

Any help would be great.

PS: Here is the full code

Sub batchlocation()

Dim R2 As Range
Set R2 = Range("C4")
Dim R3 As Range
Set R3 = Range("D4")
Dim R4 As Range
Set R4 = Range("E4")
Dim R5 As Range
Set R5 = Range("F4")

Dim myRange As Range
Dim lastRow As Integer
Dim myNum As Long
Dim myAnswer As String
Dim myCheck As Boolean
Dim n As Integer
Dim k As Integer

Range("D8").Select

Set R = ActiveCell.CurrentRegion
lastRow = R.Rows.Count
Set R = Range("A8", R(R.Count))
n = 8

For k = 1 To lastRow - 7

R.Cells(k).Select

If Cells(2, 4) = R.Cells(k).Value Then
ActiveCell.Select
ActiveCell.Offset(0, -2).Copy
R2.Select
ActiveCell.PasteSpecial
R.Select
ActiveCell.Select
ActiveCell.Offset(0, 2).Copy
R3.Select
ActiveCell.PasteSpecial
R.Select
ActiveCell.Select
ActiveCell.Offset(0, 4).Copy
R4.Select
ActiveCell.PasteSpecial
R.Select
ActiveCell.Select
ActiveCell.Offset(0, 5).Copy
R5.Select
ActiveCell.PasteSpecial
R.Select
n = n + 1
End If

Next k

If n = 8 Then
MsgBox "Batch was not found."
End If

Range("d1").Select

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
Returning a column reference for a data point Totteridge Ram Excel Discussion (Misc queries) 4 June 30th 09 03:33 PM
Data point coordinate offset in embedded chart GeoBrooks Charts and Charting in Excel 2 April 10th 09 12:00 AM
Sum and Offset: to add from a point to the last entry in the colum Ailish Excel Worksheet Functions 5 March 16th 07 05:14 PM
Returning a series collection end Point value Dan Thompson Excel Programming 2 February 23rd 07 10:06 PM
returning offset row from excel table destrolennox Excel Discussion (Misc queries) 4 July 18th 06 10:58 PM


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