Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Excel VBA - Search And Replace Cell data

I have a userform that allows the user to Add/Replace data to a spreadsheet.
Upon pressing the update button, the form updates the sheet, then opens a log
(separate workbook/sheet) in order to search 3 different columns in order to
match the cells (I have concantenated these cells together (and added an "A"
if column 3 is not "0") to form a log number (i.e. E28609, I28702A2). If the
cells match the Log number then I want to go to that row (offset to colum 7
and 8) and replace the data.

While I can update the existing form, I am having difficulty developing the
code to search and replace data in the Log. Any help would be greatly
appreciated.

'Open the EO Maintenence Log
Workbooks.Open Filename:="C:\Documents and Settings\John\My Documents\excel
****\New_EO\Engineering Maintenence Log.xls"
'Sheets("EO_LOG").Activate

Dim r As Long
Dim Irow As Long
Dim RegInit As String
Dim Col1 As Range
Dim Col2 As Range
Dim Col3 As Range

Irow = Sheet1.UsedRange.Row + _
Sheet1.UsedRange.Rows.Count
For r = 1 To Irow
Set Col1 = ActiveSheet.Range("A:A")
Set Col2 = ActiveSheet.Range("B:B")
Set Col3 = ActiveSheet.Range("C:C")
If Cells(r, Col1).value = Left(EOTemp, 1) And _
Cells(r, Col2).Value = Mid(EOTemp, 2, 5) Then
ReqInit = Initials(ComboP_Engineer)
Cells(r, 7) = ReqInit
ReqInit = Initials(ComboP_Manager)
Cells(r, 8) = ReqInit
End If
Next r
End Sub

(Note: As I am in the "development" stage, I have not added
the criteria for column 3).


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
End/Beginning of Cell Search/Replace? msnyc07 Excel Worksheet Functions 1 February 8th 10 02:37 PM
Search and Replace Entire Cell Content JerryG Excel Discussion (Misc queries) 4 May 29th 08 09:37 AM
Problem with search and replace data,thanks for you help in advance. yoyo2000 Excel Discussion (Misc queries) 1 June 20th 06 03:56 AM
cell format changing when when using search and replace. Excel Discussion (Misc queries) 0 January 6th 06 02:41 AM
cell format changing when when using search and replace. Excel Discussion (Misc queries) 0 January 6th 06 02:41 AM


All times are GMT +1. The time now is 12:33 PM.

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"