Windows 7 - Error 400 in VB editor

Asked By Howard on 13-Aug-12 07:03 PM
Excel 2010

I have had no problems using Ctrl-c and Ctrl-v to do a number of copy/paste=
=92s whilst developing stuff on a worksheet..  I have three macros that do =
stuff on that sheet.  One of the macros produces an input box for an entry =
on the sheet, you type a letter in the box and hit OK.  The input box goes =
away and the letter appears in the designated cell on the sheet.  This is a=
ll fine and good.  However, out of the blue, now if I try to do a Ctrl-c on=
a cell on the sheet the screen reverts to the VB editor and I get Error Me=
ssage 400 .  So, I look up error 400 in help and this is what it says=85

Form already displayed; cannot show modally (Error 400)    =20
This page is specific to the Visual Basic for Applications (VBA) Language R=
eference for Office 2010.=20
You cannot use the Show method to display a visible form as modal. This erro=
r has the following cause and solution:
=95 You tried to use Show, with the styleargument set to 1 -vbModal, on an =
already visible form.  Use either the Unload statement or the Hide method o=
n the form before trying to show it as a modal form. =20

I have no idea how to proceed from here.  I can only presume it has somethi=
ng to do with the input box, but what??

I can Copy on the sheet by selecting "Home" click "Copy", select the destin=
ation cell and Ctrl-v.=20
Can someone steer me through this?

Thanks=20

Regards,
Howard




Howard replied to Howard on 13-Aug-12 07:37 PM
te=92s whilst developing stuff on a worksheet..  I have three macros that d=
o stuff on that sheet.  One of the macros produces an input box for an entr=
y on the sheet, you type a letter in the box and hit OK.  The input box goe=
s away and the letter appears in the designated cell on the sheet.  This is=
all fine and good.  However, out of the blue, now if I try to do a Ctrl-c =
on a cell on the sheet the screen reverts to the VB editor and I get Error =
Message 400 .  So, I look up error 400 in help and this is what it says=85
Reference for Office 2010.=20
ror has the following cause and solution:
n already visible form.  Use either the Unload statement or the Hide method=
on the form before trying to show it as a modal form. =20
hing to do with the input box, but what??
ination cell and Ctrl-v.=20

Forgot to post the code that produces the input box.

Sub XandO()

Dim j As Integer
Dim c As Range
Dim CName As String
j =3D Range("AB1").End(xlToLeft).Column

CName =3D InputBox("Enter a duplicated leter in AB4", "Donkey Letter")
Range("AB4") =3D CName

Range("A1").Resize(1, j).Select
With Selection
For Each c In Selection
If c.Value <> "" Then c.Offset(1, 0).Value =3D "X"
If c.Value =3D Range("AB4") Then c.Offset(1, 0).Value =3D "O"
If c.Value =3D "" Then c.Offset(1, 0).Value =3D " "
Next
End With

AllInCell ' This macro puts all the X O,s into one cell

Range("A1").Resize(1, j).ClearContents
Range("A2").Resize(1, j).ClearContents
Range("A1").Select

End Sub

Regards,
Howard