ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   messagebox problem (https://www.excelbanter.com/excel-programming/322499-messagebox-problem.html)

Sam

messagebox problem
 
Hi,

I would like to be able to have my userform give back the
information message if there is already a value in the
destination saying -

"A2 already has a value! would you like
to replace " + x " with " y "?"

my code looks like this

- Set Rng = shData.Range("I" & Application.Match(CLng
(sh.Range("D6")), shData.Range("B:B"), 0))
Rng.Value = sh.Range("D8").Text

Thank you for your help

Dave Peterson[_5_]

messagebox problem
 
Dim Resp as long
....your declares
set rng = ....

resp = vbyes
if rng.value < "" then
resp = msgbox("Overwrite " & rng.address(0,0) & ". It contains: " _
& rng.value, buttons:=vbyesno)
end if
if resp = vbyes then
rng.value = sh.Range("D8").Text
else
msgbox "come back later..."
end if



Sam wrote:

Hi,

I would like to be able to have my userform give back the
information message if there is already a value in the
destination saying -

"A2 already has a value! would you like
to replace " + x " with " y "?"

my code looks like this

- Set Rng = shData.Range("I" & Application.Match(CLng
(sh.Range("D6")), shData.Range("B:B"), 0))
Rng.Value = sh.Range("D8").Text

Thank you for your help


--

Dave Peterson


All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com