Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Error 400 in VB editor

Excel 2010

I have had no problems using Ctrl-c and Ctrl-v to do a number of copy/paste’s 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 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…

Form already displayed; can't show modally (Error 400)
This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.
You can't use the Show method to display a visible form as modal. This error has the following cause and solution:
• 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 on the form before trying to show it as a modal form.

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

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

Thanks

Regards,
Howard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Error 400 in VB editor

On Monday, August 13, 2012 4:03:04 PM UTC-7, Howard wrote:
Excel 2010



I have had no problems using Ctrl-c and Ctrl-v to do a number of copy/paste’s 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 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…



Form already displayed; can't show modally (Error 400)

This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

You can't use the Show method to display a visible form as modal. This error has the following cause and solution:

• 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 on the form before trying to show it as a modal form.



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



I can Copy on the sheet by selecting "Home" click "Copy", select the destination cell and Ctrl-v.

Can someone steer me through this?



Thanks



Regards,

Howard


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 = Range("AB1").End(xlToLeft).Column

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

Range("A1").Resize(1, j).Select
With Selection
For Each c In Selection
If c.Value < "" Then c.Offset(1, 0).Value = "X"
If c.Value = Range("AB4") Then c.Offset(1, 0).Value = "O"
If c.Value = "" Then c.Offset(1, 0).Value = " "
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Error 400 in VB editor

Howard,

I can't seem to duplicate the error, so I'm not sure if this will help. However, it could be that CTRL+c (or CTRL+v)has been inadvertently assigned to one of your macros, causing it to run when you are not expecting it to.

I could not find any reason why the code you posted would cause the inputbox to remain open, so perhaps another piece of code (such as the AllInCell sub that this code calls) is the culprit.

Since it looks like AllInCell is just concatenating all of the X's and O's, I think you could eliminate the other routine altogether. The sub I wrote below will build the X's, O's and spaces and place the result in cell A2. Hope it helps.

-Ben

Sub XandO()

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

CName = InputBox("Enter a duplicated leter in AB4", "Donkey Letter")
If CName = vbNullString Then Exit Sub
Range("AB4") = CName
CName = vbNullString

For Each c In Range("A1").Resize(1, j)
Select Case c.Value
Case Is = Range("AB4").Value
CName = CName & "O"
Case Is = vbNullString
CName = CName & " "
Case Else
CName = CName & "X"
End Select
Next

Range("A2").Value = CName ' This puts all the X O,s into one cell

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

End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Error 400 in VB editor

On Monday, August 13, 2012 4:03:04 PM UTC-7, Howard wrote:
Excel 2010



I have had no problems using Ctrl-c and Ctrl-v to do a number of copy/paste’s 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 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…



Form already displayed; can't show modally (Error 400)

This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

You can't use the Show method to display a visible form as modal. This error has the following cause and solution:

• 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 on the form before trying to show it as a modal form.



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



I can Copy on the sheet by selecting "Home" click "Copy", select the destination cell and Ctrl-v.

Can someone steer me through this?



Thanks



Regards,

Howard


I did indeed assign Ctrl-c to a macro... I had it a short-cut to a "Clear" macro. Fixed that and iit works fine.

Thanks
Regards,Howard
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
"Out of Memory" error in editor Trefor Excel Programming 5 August 2nd 09 09:16 PM
VBA Editor Ken G Setting up and Configuration of Excel 2 July 10th 09 02:03 PM
VBA editor Yara Excel Discussion (Misc queries) 4 October 16th 07 11:24 PM
VB Editor Mike H. Excel Programming 3 August 31st 07 04:27 PM
VB Editor mlh Excel Discussion (Misc queries) 2 June 29th 07 01:17 PM


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