Help with finishing a macro

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

Hi all..

This is what I have that works so far..

Sub IDC()
Range("A1").Select
Cells.Replace What:="XX/XX", Replacement:="WFL/ME", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("A1").Select
Selection.Copy
ActiveSheet.Paste
Range("A2").Select
End Sub

This is the text in cell A1 that I would like to stay constant after I
complete my macro…

COPY (WHITE)XX/XX AS (BLUE)XX/XX, (WHITE)XX/XX AS (GOLD)XX/XX, (WHITE)XX/XX
AS (SILVER)XX/XX, (WHITE)XX/XX AS (JADE)XX/XX, (WHITE)XX/XX AS (TAN)XX/XX,
(WHITE)XX/XX AS (DIAMOND)XX/XX, (WHITE)XX/XX AS (PURPLE)XX/XX FROM DISK(PACK)
TO DISK(PACK)

This is what I would like to accomplish…

Replace all the XX/XX using a input box that I would enter the
Replacement.Text = value from input box. This will always be different, not
always 'WFL/ME.

Copy the entire doc to clipboard.

Close Excel without saving the changes and without having to manually hit
the 'NO' to 'Do you want to save the changes' box.

What I need help with is the input box putting the info into the
'Replacement.Text' field (by variable?) and the part at the end getting Excel
to close without saving changes and automatically choosing 'NO' to 'Do you
want to save the changes' .

I use Office XP.

Any help would be appreciated.

Thanx, Dennis
===================
 
Dennis,

Is this what you want?

Sub IDC()
Dim sSub As String

sSub = InputBox("Replacement value")
With Range("A1")
.Replace What:="XX/XX", Replacement:=sSub, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End With

Cells.Copy

Activeworkbook.Saved = True

Application.Quit

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top