Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Searching for cell values

I'm trying to come up with a macro, but i'm having some
trouble.

I have 3 columns in sheet "ChopList" and 3 columns in
sheet "CALC4". I need the macro to look at columns F, H,
and J on sheet "ChopList" and find the row in which the
cell values are the same in columns B,C, and D on
sheet "CALC4" and copy the value of the last populated
cell of that row to Column L of sheet "ChopList" in the
row with the same values.

Pretty difficult for me to explain, if you need more info
let me know.

Thanks very much in advance for any input.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Searching for cell values

Try this:

Sub Test()
Dim wks1 As Worksheet, wks2 As Worksheet
Dim rng1 As Range, rng2 As Range
Dim c1 As Range, c2 As Range, c3 As Range
Dim rw As Long, col As Long
Dim txt1 As String, txt2 As String

Set wks1 = Sheets("ChopList")
Set wks2 = Sheets("Calc4")
rw = wks1.Cells(Rows.Count, 6).End(xlUp).Row
With wks1
Set rng1 = Range(.Cells(1, 6), .Cells(rw, 6))
End With
With wks2
Set rng2 = Range(.Cells(1, 2), .Cells(rw, 2))
End With
Application.ScreenUpdating = False
For Each c1 In rng1
For Each c2 In rng2
txt1 = Trim(c1) & Trim(c1(1, 3)) & Trim(c1(1, 5))
txt2 = Trim(c2) & Trim(c2(1, 2)) & Trim(c2(1, 3))
If txt1 = txt2 Then
col = wks2.Cells(c2.Row, 256).End(xlToLeft).Column
Set c3 = wks2.Cells(c2.Row, col)
c1(1, 7) = c3
End If
Next c2
Next
Application.ScreenUpdating = True
End Sub

Regards,
Greg


-----Original Message-----
I'm trying to come up with a macro, but i'm having some
trouble.

I have 3 columns in sheet "ChopList" and 3 columns in
sheet "CALC4". I need the macro to look at columns F, H,
and J on sheet "ChopList" and find the row in which the
cell values are the same in columns B,C, and D on
sheet "CALC4" and copy the value of the last populated
cell of that row to Column L of sheet "ChopList" in the
row with the same values.

Pretty difficult for me to explain, if you need more info
let me know.

Thanks very much in advance for any input.
.

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
Searching for values Paul Peterson - Velox Consulting, LLC Excel Discussion (Misc queries) 1 December 8th 09 04:50 PM
Searching for a cell with specified values FredL Excel Discussion (Misc queries) 6 March 16th 07 04:49 PM
Searching for cell values alistre Excel Discussion (Misc queries) 2 August 24th 06 03:45 AM
searching for values and summing the corresponding values Simon Excel Worksheet Functions 1 February 4th 05 12:13 AM
Searching values in VBA Pierre Leclerc[_2_] Excel Programming 1 May 25th 04 03:41 PM


All times are GMT +1. The time now is 03:44 PM.

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"