LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default tried to change my code but cant get it to work.

Hi I have been using the following code to try and
achieve the following -

*If the destination cell already has a value and the form
cell is blank then do not overwrite move to the next form
entry cell.

*If the form has a value, and the destination cell has a
value display the message asking whether or not to
replace.

*If the form has a value but the destination cell does
not then enter the value then move on to the next without
messagebox.

This is the code which works perfectly but asks if I
would like to replace a value with a blank if the form
cell is empty and the destination cell has a value.

Thanks a lot for your help. I really appreciate it.

Rob

Set Rng = shData.Range("E" & Application.Match(CLng
(Sh.Range("D6")), shData.Range("B:B"), 0))
Resp = vbYes
If Rng.Value < "" Then
Resp = MsgBox("Digester 1 Temp Already Contains a value
of : " & Rng.Value & " " & Chr(176) & "C" & vbCr _
& "Would you like to change its value to : "
& Sh.Range("D8") & " " & Chr(176) & "C", Buttons:=vbYesNo)
End If
If Resp = vbYes Then
Rng.Value = Sh.Range("D8").Text
Else
End If

--- and this is the code i have tried to change to allow
me to take into consideration all of the 3 things at the
top of the page. Its almost as if when I tell it to goto
1 it does but then goes back up and runs through the rest
of the code too!!

Dim Rng As Range

Set Rng = shData.Range("E" & WorksheetFunction.Match
(Sh.Range("D6"), shData.Range("B:B"), 0))
Resp = vbYes
If Rng.Value = "" Then
GoTo 1
Else
End If
If Rng.Value < "" Then
Resp = MsgBox("Digester 1 Temp Already Contains a value
of : " & Rng.Value & " " & Chr(176) & "C" & vbCr _
& "Would you like to change its value to : "
& Sh.Range("D8") & " " & Chr(176) & "C", Buttons:=vbYesNo)
End If
If Resp = vbYes Then
Rng.Value = Sh.Range("D8").Text
Else
1
End If

Set Rng = Nothing
 
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
Why this code is not work? Error code when select worksheet Excel Worksheet Functions 4 December 4th 07 12:51 AM
How can I get this code to work? Sam Excel Programming 1 February 2nd 05 12:24 AM
Help getting code to work. Myrna Larson Excel Programming 2 July 29th 04 07:07 AM
Why my code do not work : - ( keepitcool Excel Programming 5 September 5th 03 06:28 PM
Why my code do not work : - ( Tom Ogilvy Excel Programming 1 August 31st 03 04:53 PM


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