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

I have 3 columns in sheet totals, Date, ID & Status

and 3 cells in sheet Aug B1, B2 & B3 where we can enter Date, ID & Status
and when clicked on submit button, I need a macro to match date and ID from
sheet totals and replace Status again in sheet totals.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Find and replace

On 25 Aug, 07:54, Kash wrote:
I have 3 columns in sheet totals, Date, ID & Status

and 3 cells in sheet Aug B1, B2 & B3 where we can enter Date, ID & Status
and when clicked on submit button, I need a macro to match date and ID from
sheet totals and replace Status again in sheet totals.


Can you add a calculated column that contains the CONCATENATE of the
Date and ID (with a separator), e.g. =CONCATENATE(A1,"|",B1)? Then
when you do a Find(), you need to use the Value2 of the date cell in
order to get it in the same format as the cell formula:

Dim Cell As Range
Set Cell = Sheets("totals").Cells.Find(Cells(1,1).Value2 & "|" & Cells
(1,2))
Sheets("totals").Cells(Cell.Row,Cell.Column+1) = Cells(1,3)

Code is untested.

Phil Hibbs.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Find and replace

assumes D,E and F are Date,ID and Status on totals sheet. change accordingly

Option Explicit
Sub UpdateTable()

Dim aDate As Date
Dim aID As String
Dim aStatus As String
Dim bFound As Boolean

With Worksheets("aug")
aDate = .Range("B1")
aID = .Range("B2")
aStatus = .Range("B3")
End With

With Worksheets("totals")

Dim index As Long
index = 1

Do Until IsEmpty(.Cells(index, "D"))

If .Cells(index, "D") = aDate Then
If .Cells(index, "E") = aID Then
.Cells(index, "F") = aStatus
bFound = True
Exit Do
End If

End If


index = index + 1
Loop

If bFound Then
MsgBox aID & " for " & aDate & " changed to " & aStatus
Else
MsgBox aID & " for " & aDate & " was not found"
End If

End With






End Sub


"Phil Hibbs" wrote:

On 25 Aug, 07:54, Kash wrote:
I have 3 columns in sheet totals, Date, ID & Status

and 3 cells in sheet Aug B1, B2 & B3 where we can enter Date, ID & Status
and when clicked on submit button, I need a macro to match date and ID from
sheet totals and replace Status again in sheet totals.


Can you add a calculated column that contains the CONCATENATE of the
Date and ID (with a separator), e.g. =CONCATENATE(A1,"|",B1)? Then
when you do a Find(), you need to use the Value2 of the date cell in
order to get it in the same format as the cell formula:

Dim Cell As Range
Set Cell = Sheets("totals").Cells.Find(Cells(1,1).Value2 & "|" & Cells
(1,2))
Sheets("totals").Cells(Cell.Row,Cell.Column+1) = Cells(1,3)

Code is untested.

Phil Hibbs.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Find and replace

How to select corresponding row without entering any value?
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Find and replace

??

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kash" wrote in message
...
How to select corresponding row without entering any value?




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 - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Find/Replace Event or Find/Replace for Protected Sheet ... Joe HM Excel Programming 2 October 27th 07 03:55 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Using Find and Replace to replace " in a macro snail30152 Excel Programming 1 April 13th 06 11:58 PM
Replace method - cannot find any data to replace Mike Excel Programming 5 April 6th 06 08:56 PM


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