Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Out of Memory" error in editor | Excel Programming | |||
VBA Editor | Setting up and Configuration of Excel | |||
VBA editor | Excel Discussion (Misc queries) | |||
VB Editor | Excel Programming | |||
VB Editor | Excel Discussion (Misc queries) |