I'm having an Automation error 404 while trying to refresh activex listbox filledrangeHow do I find the last row that contains data where cells may contain empty text “”?Conditional copy Excel File-2 data to excel file-1?Copy only selected table columns after filter to new worksheetVba Code to Delete data based on a drop box choiceHow to resolve VBA runtime error 1004If cell = closed project, cut cell and past into “Projects closed” worksheet on next available rowHow to reference same dates between worksheets?Excel VBA - Overflow error on Range selectHow can I ignore an email attachment if missing from folderError 1004 when tried to change data in secondary worksheet
Can a network vulnerability be exploited locally?
In Endgame, wouldn't Stark have remembered Hulk busting out of the stairwell?
Don't look at what I did there
Was it illegal to blaspheme God in Antioch in 360.-410.?
Why didn't Doc believe Marty was from the future?
Did the Apollo Guidance Computer really use 60% of the world's ICs in 1963?
Wrong Stamping of UK Visa
What is the sound/audio equivalent of "unsightly"?
How to differentiate between two people with the same name in a story?
Group riding etiquette
Fixing a blind bolt hole when the first 2-3 threads are ruined?
Why is 3/4 a simple meter while 6/8 is a compound meter?
Get contents before a colon
Moscow SVO airport, how to avoid scam taxis without pre-booking?
How can I observe Sgr A* with itelescope.net
Could a complex system of reaction wheels be used to propel a spacecraft?
Are sweatpants frowned upon on flights?
How to understand payment due date for credit card?
Why are JWST optics not enclosed like HST?
Why do motor drives have multiple bus capacitors of small value capacitance instead of a single bus capacitor of large value?
Inspiration for failed idea?
Defending Castle from Zombies
Is this position a forced win for Black after move 14?
Can two aircraft be allowed to stay on the same runway at the same time?
I'm having an Automation error 404 while trying to refresh activex listbox filledrange
How do I find the last row that contains data where cells may contain empty text “”?Conditional copy Excel File-2 data to excel file-1?Copy only selected table columns after filter to new worksheetVba Code to Delete data based on a drop box choiceHow to resolve VBA runtime error 1004If cell = closed project, cut cell and past into “Projects closed” worksheet on next available rowHow to reference same dates between worksheets?Excel VBA - Overflow error on Range selectHow can I ignore an email attachment if missing from folderError 1004 when tried to change data in secondary worksheet
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm worikng on a project for my senior year project and I have to deal with the Activex controls for my userinterface. For deleting the single item in the listbox, I have written the code below.
When I debug the code, I'm having an "automation error 404" at the last part of my code:
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
Here is my code:
Dim i As Integer
Dim lastrow As Integer
lastrow = Sheets("SrData").Cells(Sheets("SrData").Rows.Count, "A").End(xlUp).Row
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = Sheets("SrData").Cells(i, 1)
listcontrol = Sheets("Solve").ListBox1.List(Sheets("Solve").ListBox1.ListIndex)
If sheetcontrol = listcontrol Then
Sheets("SrData").Activate
ActiveWorkbook.Names("SrDat").Delete
Sheets("SrData").Rows(i).Select
Selection.Delete
Sheets("SrData").Range(Sheets("SrData").Cells(2, 1), Sheets("SrData").Cells(lastrow - 1, 3)).Select
ActiveWorkbook.Names.Add Name:="SrDat", RefersTo:=Selection
End If
Next i
End If
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
excel vba
add a comment |
I'm worikng on a project for my senior year project and I have to deal with the Activex controls for my userinterface. For deleting the single item in the listbox, I have written the code below.
When I debug the code, I'm having an "automation error 404" at the last part of my code:
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
Here is my code:
Dim i As Integer
Dim lastrow As Integer
lastrow = Sheets("SrData").Cells(Sheets("SrData").Rows.Count, "A").End(xlUp).Row
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = Sheets("SrData").Cells(i, 1)
listcontrol = Sheets("Solve").ListBox1.List(Sheets("Solve").ListBox1.ListIndex)
If sheetcontrol = listcontrol Then
Sheets("SrData").Activate
ActiveWorkbook.Names("SrDat").Delete
Sheets("SrData").Rows(i).Select
Selection.Delete
Sheets("SrData").Range(Sheets("SrData").Cells(2, 1), Sheets("SrData").Cells(lastrow - 1, 3)).Select
ActiveWorkbook.Names.Add Name:="SrDat", RefersTo:=Selection
End If
Next i
End If
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
excel vba
add a comment |
I'm worikng on a project for my senior year project and I have to deal with the Activex controls for my userinterface. For deleting the single item in the listbox, I have written the code below.
When I debug the code, I'm having an "automation error 404" at the last part of my code:
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
Here is my code:
Dim i As Integer
Dim lastrow As Integer
lastrow = Sheets("SrData").Cells(Sheets("SrData").Rows.Count, "A").End(xlUp).Row
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = Sheets("SrData").Cells(i, 1)
listcontrol = Sheets("Solve").ListBox1.List(Sheets("Solve").ListBox1.ListIndex)
If sheetcontrol = listcontrol Then
Sheets("SrData").Activate
ActiveWorkbook.Names("SrDat").Delete
Sheets("SrData").Rows(i).Select
Selection.Delete
Sheets("SrData").Range(Sheets("SrData").Cells(2, 1), Sheets("SrData").Cells(lastrow - 1, 3)).Select
ActiveWorkbook.Names.Add Name:="SrDat", RefersTo:=Selection
End If
Next i
End If
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
excel vba
I'm worikng on a project for my senior year project and I have to deal with the Activex controls for my userinterface. For deleting the single item in the listbox, I have written the code below.
When I debug the code, I'm having an "automation error 404" at the last part of my code:
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
Here is my code:
Dim i As Integer
Dim lastrow As Integer
lastrow = Sheets("SrData").Cells(Sheets("SrData").Rows.Count, "A").End(xlUp).Row
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = Sheets("SrData").Cells(i, 1)
listcontrol = Sheets("Solve").ListBox1.List(Sheets("Solve").ListBox1.ListIndex)
If sheetcontrol = listcontrol Then
Sheets("SrData").Activate
ActiveWorkbook.Names("SrDat").Delete
Sheets("SrData").Rows(i).Select
Selection.Delete
Sheets("SrData").Range(Sheets("SrData").Cells(2, 1), Sheets("SrData").Cells(lastrow - 1, 3)).Select
ActiveWorkbook.Names.Add Name:="SrDat", RefersTo:=Selection
End If
Next i
End If
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
excel vba
excel vba
edited Mar 27 at 22:55
Vityata
34.5k7 gold badges24 silver badges57 bronze badges
34.5k7 gold badges24 silver badges57 bronze badges
asked Mar 27 at 22:10
Övünç GüneriÖvünç Güneri
131 bronze badge
131 bronze badge
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I would try working with something like this:
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) Then
ListBox1.RemoveItem i
End If
Next i
Edit: then you can delete the row at your “Solve” sheet with your code and update listrange like this:
Private sub userform_initialize()
With Worksheets("Solve").Range("A2:A" & lastrow) '<-- change with your range
Me.ListBox1.List = Application.Transpose(.Cells)
Set listRng = .Cells
End With
End Sub
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
add a comment |
I have found an solution for my problem here is my edited code.
Set s = Worksheets("Solve")
Set sd = Worksheets("SrData")
Dim lastrow As Integer
Dim target As String
Dim sheetcontrol As String
Application.ScreenUpdating = False
target = s.ListBox1.List(s.ListBox1.ListIndex)
lastrow = sd.Cells(sd.Rows.Count, "A").End(xlUp).Row
If IsNull(ListBox1) Then
MsgBox "You haven't selected an Sales Representative. Please Select one."
Else
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = sd.Cells(i, 1)
If sheetcontrol = target Then
s.ListBox1.ListIndex = -1
sd.Rows(i).Delete
sd.Activate
ActiveWorkbook.Names("SrDat").Delete
Range("'SrData'!$A$2:$C$" & lastrow - 1).Name = "SrDat"
s.Activate
End If
Next i
End If
End If
refSr
Application.ScreenUpdating = True
in refSr part I'm doing the
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387242%2fim-having-an-automation-error-404-while-trying-to-refresh-activex-listbox-fille%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would try working with something like this:
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) Then
ListBox1.RemoveItem i
End If
Next i
Edit: then you can delete the row at your “Solve” sheet with your code and update listrange like this:
Private sub userform_initialize()
With Worksheets("Solve").Range("A2:A" & lastrow) '<-- change with your range
Me.ListBox1.List = Application.Transpose(.Cells)
Set listRng = .Cells
End With
End Sub
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
add a comment |
I would try working with something like this:
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) Then
ListBox1.RemoveItem i
End If
Next i
Edit: then you can delete the row at your “Solve” sheet with your code and update listrange like this:
Private sub userform_initialize()
With Worksheets("Solve").Range("A2:A" & lastrow) '<-- change with your range
Me.ListBox1.List = Application.Transpose(.Cells)
Set listRng = .Cells
End With
End Sub
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
add a comment |
I would try working with something like this:
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) Then
ListBox1.RemoveItem i
End If
Next i
Edit: then you can delete the row at your “Solve” sheet with your code and update listrange like this:
Private sub userform_initialize()
With Worksheets("Solve").Range("A2:A" & lastrow) '<-- change with your range
Me.ListBox1.List = Application.Transpose(.Cells)
Set listRng = .Cells
End With
End Sub
I would try working with something like this:
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) Then
ListBox1.RemoveItem i
End If
Next i
Edit: then you can delete the row at your “Solve” sheet with your code and update listrange like this:
Private sub userform_initialize()
With Worksheets("Solve").Range("A2:A" & lastrow) '<-- change with your range
Me.ListBox1.List = Application.Transpose(.Cells)
Set listRng = .Cells
End With
End Sub
edited Mar 28 at 22:44
answered Mar 27 at 22:35
user8608712
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
add a comment |
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Thanks for your answer. Yes this could also work but ı should have to update my source sheet. this is why ı have done the way that ı used in the code. Also this still not solves my problem too. :(
– Övünç Güneri
Mar 27 at 22:59
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Sorry, I edited the code... hope it helps!
– user8608712
Mar 28 at 22:45
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
Thanks for your answer again. But as I have mentioned in the description its an Activex listbox which is located in the worksheet, its not located in the userform. I've tried what you have suggested to me but it's not working for the Activex objects.
– Övünç Güneri
Mar 29 at 11:27
add a comment |
I have found an solution for my problem here is my edited code.
Set s = Worksheets("Solve")
Set sd = Worksheets("SrData")
Dim lastrow As Integer
Dim target As String
Dim sheetcontrol As String
Application.ScreenUpdating = False
target = s.ListBox1.List(s.ListBox1.ListIndex)
lastrow = sd.Cells(sd.Rows.Count, "A").End(xlUp).Row
If IsNull(ListBox1) Then
MsgBox "You haven't selected an Sales Representative. Please Select one."
Else
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = sd.Cells(i, 1)
If sheetcontrol = target Then
s.ListBox1.ListIndex = -1
sd.Rows(i).Delete
sd.Activate
ActiveWorkbook.Names("SrDat").Delete
Range("'SrData'!$A$2:$C$" & lastrow - 1).Name = "SrDat"
s.Activate
End If
Next i
End If
End If
refSr
Application.ScreenUpdating = True
in refSr part I'm doing the
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
add a comment |
I have found an solution for my problem here is my edited code.
Set s = Worksheets("Solve")
Set sd = Worksheets("SrData")
Dim lastrow As Integer
Dim target As String
Dim sheetcontrol As String
Application.ScreenUpdating = False
target = s.ListBox1.List(s.ListBox1.ListIndex)
lastrow = sd.Cells(sd.Rows.Count, "A").End(xlUp).Row
If IsNull(ListBox1) Then
MsgBox "You haven't selected an Sales Representative. Please Select one."
Else
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = sd.Cells(i, 1)
If sheetcontrol = target Then
s.ListBox1.ListIndex = -1
sd.Rows(i).Delete
sd.Activate
ActiveWorkbook.Names("SrDat").Delete
Range("'SrData'!$A$2:$C$" & lastrow - 1).Name = "SrDat"
s.Activate
End If
Next i
End If
End If
refSr
Application.ScreenUpdating = True
in refSr part I'm doing the
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
add a comment |
I have found an solution for my problem here is my edited code.
Set s = Worksheets("Solve")
Set sd = Worksheets("SrData")
Dim lastrow As Integer
Dim target As String
Dim sheetcontrol As String
Application.ScreenUpdating = False
target = s.ListBox1.List(s.ListBox1.ListIndex)
lastrow = sd.Cells(sd.Rows.Count, "A").End(xlUp).Row
If IsNull(ListBox1) Then
MsgBox "You haven't selected an Sales Representative. Please Select one."
Else
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = sd.Cells(i, 1)
If sheetcontrol = target Then
s.ListBox1.ListIndex = -1
sd.Rows(i).Delete
sd.Activate
ActiveWorkbook.Names("SrDat").Delete
Range("'SrData'!$A$2:$C$" & lastrow - 1).Name = "SrDat"
s.Activate
End If
Next i
End If
End If
refSr
Application.ScreenUpdating = True
in refSr part I'm doing the
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
I have found an solution for my problem here is my edited code.
Set s = Worksheets("Solve")
Set sd = Worksheets("SrData")
Dim lastrow As Integer
Dim target As String
Dim sheetcontrol As String
Application.ScreenUpdating = False
target = s.ListBox1.List(s.ListBox1.ListIndex)
lastrow = sd.Cells(sd.Rows.Count, "A").End(xlUp).Row
If IsNull(ListBox1) Then
MsgBox "You haven't selected an Sales Representative. Please Select one."
Else
If MsgBox("Are you sure you want to delete this Sales Representative?", vbYesNo + vbQuestion, "Delete Sales Representative") = vbYes Then
For i = 2 To lastrow
sheetcontrol = sd.Cells(i, 1)
If sheetcontrol = target Then
s.ListBox1.ListIndex = -1
sd.Rows(i).Delete
sd.Activate
ActiveWorkbook.Names("SrDat").Delete
Range("'SrData'!$A$2:$C$" & lastrow - 1).Name = "SrDat"
s.Activate
End If
Next i
End If
End If
refSr
Application.ScreenUpdating = True
in refSr part I'm doing the
With Worksheets("Solve").OLEObjects("ListBox1")
.ListFillRange = .ListFillRange
End With
answered Apr 9 at 23:12
Övünç GüneriÖvünç Güneri
131 bronze badge
131 bronze badge
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387242%2fim-having-an-automation-error-404-while-trying-to-refresh-activex-listbox-fille%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown