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: 852
Default Transfer array element offset value to a matched value


Columns A,B (C IS BLANK) D,E


10000001 23 10000027 001
10000002 2 10000037 013
10000003 11 10000008 028
10000004 11 10000059 011
10000005 11 10000065 001
10000006 1 10000066 011
10000007 92 10000070 001
10000008 99 10000137 001
10000009 0 10000138 001

If a value in column D is found in column A, then replace the value in column B with the value in column E.

The only match in example is 1000008, so the 99 in column B would be replaced with the value 028 from column E.

And column C would be noted with **X**.

Column A/B about 11,000 rows, column D/E about 700 rows.

Thanks,
Howard

The commented out code lines do not work for me.

Sub A_D_Var_Range()

Dim lr As Long, i As Long
Dim c As Range, aChng As Range
Dim dArray As Variant
Dim vArr As Range


With Sheets("Sheet1")
lr = .Cells(Rows.Count, "D").End(xlUp).Row
dArray = .Range("D2:D" & lr)


For i = 2 To UBound(dArray)

' Set vArr = dArray(i, 1).Offset(, 1)

Set aChng = Sheets("Sheet1").Range("A:A").Find(What:=dArray(i, 1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If Not aChng Is Nothing Then

'***
'aChng.Offset(, 1) = dArray(i, 1).Offset(, 1).Value
'aChng.Offset(, 1) = vArr
'***

aChng.Offset(, 2) = "**X**"
Else
MsgBox "No match found. "
End If

Next 'i
End With

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
randomly picking up an array element from an array of elements Sanjog Excel Discussion (Misc queries) 3 August 8th 12 11:04 PM
VBA Offset (trying to resize an element within nested array) ker_01 Excel Programming 1 July 16th 09 02:46 AM
Rules for element-by-element product in array multiplication Paul Excel Programming 2 March 22nd 08 11:42 PM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 6 November 9th 05 05:54 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM


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