Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Find Values and Update

I have a worksheet that has thousands of serial numbers in column B
that have a date to be updated daily in column D, E, and F. Currently
I have to go through manually and find and match the serials from H to
B, then update the corresponding Column D,E, or F. How do I match
values from H with values from B and update dates in D or E or F from
I. Any help would be greatly appreciated I don't really know what I am
doing....

A B C D E F G H I
123 456 dateB
456 912 dateC
678
912
243

Thanks
Glenn

  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default Find Values and Update

What determines whether D, E or F gets the date from I ?

VLOOKUP seems like a good candidate here.

Tim


"QTGlennM" wrote in message
ups.com...
I have a worksheet that has thousands of serial numbers in column B
that have a date to be updated daily in column D, E, and F. Currently
I have to go through manually and find and match the serials from H to
B, then update the corresponding Column D,E, or F. How do I match
values from H with values from B and update dates in D or E or F from
I. Any help would be greatly appreciated I don't really know what I am
doing....

A B C D E F G H I
123 456 dateB
456 912 dateC
678
912
243

Thanks
Glenn



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Find Values and Update

As Tim said, it would help to know what's going on in Columns D-F. This
problem is solved better with a macro. Suppose these columns have the most
recent dates, with the most recent date in Column D. Do the following:

1. Make sure the Control Toolbox toolbar is visible by clicking the
ViewToolbars menu items in Excel.

2. Click the Command Button icon on this toolbar to create a command button.

3. Right click the new button and select Properties, which will bring up the
properties window. Change the Name property to "cmdUpdate" and the Caption
property to "Update". If you want, you can change the appearance, such as
font, using the other properties.

4. Right the button again and select View Code. This puts you in the VBA
editor, where you'll see

Private Sub cmdUpdate_Click()

End Sub

5. Copy the following code into this procedure

Private Sub cmdUpdate_Click()

Const iDATE_COLUMN_OFFSET As Integer = 2
Const iNUMBER_DATE_COLUMNS As Integer = 3
Const iNEWVALS_COLUMN_OFFSET As Integer = 6

Const strHOMECELL As String = "B1"

Dim i As Integer
Dim j As Integer
Dim iNew_count As Integer

Dim iSerial_num As Long

Dim rngHome As Range

Set rngHome = ThisWorkbook.ActiveSheet.Range(strHOMECELL)

With rngHome
' Determine the number of update items
iNew_count = 0

Do Until .Offset(iNew_count, iNEWVALS_COLUMN_OFFSET).Value = ""
iNew_count = iNew_count + 1
Loop

' Now check each serial number to see if needs an update
iSerial_num = 0

Do Until .Offset(iSerial_num, 0).Value = ""
' Compare this serial number against those in the update list
For i = 0 To iNew_count - 1
If .Offset(i, iNEWVALS_COLUMN_OFFSET).Value = _
.Offset(iSerial_num, 0).Value Then
' Found a match
GoSub UpdateDates
Exit For
End If
Next i

iSerial_num = iSerial_num + 1
Loop
End With

Exit Sub


UpdateDates:

With rngHome
' Move the old date values one column over
For j = iNUMBER_DATE_COLUMNS - 1 To 1 Step -1
.Offset(iSerial_num, iDATE_COLUMN_OFFSET + j).Value = _
.Offset(iSerial_num, iDATE_COLUMN_OFFSET + j - 1).Value
Next j

' Put the new date in the first of the date columns
.Offset(iSerial_num, iDATE_COLUMN_OFFSET).Value = _
.Offset(i, iNEWVALS_COLUMN_OFFSET + 1).Value
End With
Return

End Sub

6. Return to the spreadsheet and click the Exit Design Mode button on the
Control Toolbox toolbar to make the button active. To update the list, just
click the Update button you have created.

Note that the actual updating all occurs in the subroutine UpdateDates. I've
written to update based on my supposition for the function of columns D-F.
Change the subroutine to accomplish whatever else you might want to do.

I hope this helps. Good luck.

"Tim" wrote:

What determines whether D, E or F gets the date from I ?

VLOOKUP seems like a good candidate here.

Tim


"QTGlennM" wrote in message
ups.com...
I have a worksheet that has thousands of serial numbers in column B
that have a date to be updated daily in column D, E, and F. Currently
I have to go through manually and find and match the serials from H to
B, then update the corresponding Column D,E, or F. How do I match
values from H with values from B and update dates in D or E or F from
I. Any help would be greatly appreciated I don't really know what I am
doing....

A B C D E F G H I
123 456 dateB
456 912 dateC
678
912
243

Thanks
Glenn




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
Find and Replace Vs Update Values In DOUG ECKERT[_2_] Excel Worksheet Functions 0 March 3rd 08 03:29 PM
find values in multiple cells and paste row values izzyt1972 Excel Discussion (Misc queries) 5 December 26th 07 10:14 PM
find and update Keith Teeter Excel Programming 1 April 24th 07 08:22 PM
Find and Update Macro hnyb1 Excel Discussion (Misc queries) 2 October 11th 05 03:30 PM
Search/Filter to find values in another range based on two cell values Andy Excel Programming 2 April 29th 04 04:08 PM


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