excel-vba

VBA Debugger shows only 256 elements of a collection

匆匆过客 提交于 2020-02-16 05:50:11
问题 the title explains my problem. Im working on an excelmakro and my questions is, is there an option that the debugger shows all elements like it does with an array? And if not, is the only workaround the storage of my classobjects in an array after inflating the collection? I appreciate your help. 回答1: You could use debug.print and write the output into the immediate window and bypass the limit that way. I am almost certain that there is no way to increase that limit, but maybe someone else

VBA Debugger shows only 256 elements of a collection

三世轮回 提交于 2020-02-16 05:49:27
问题 the title explains my problem. Im working on an excelmakro and my questions is, is there an option that the debugger shows all elements like it does with an array? And if not, is the only workaround the storage of my classobjects in an array after inflating the collection? I appreciate your help. 回答1: You could use debug.print and write the output into the immediate window and bypass the limit that way. I am almost certain that there is no way to increase that limit, but maybe someone else

Application-defined or object-defined error 1004

故事扮演 提交于 2020-02-15 22:57:07
问题 VBA is throwing the above given error on the line Sheets("Sheet1").Range("A" & i).Copy Destination:=Sheets("Sheet2").Range("A" & i & "A" & LastCol - 1) What I am trying to do is actually to copy the "A" & i cell (in first iteration it's A2 ) to a range in the second worksheet named Sheet2. Sub FindFill() Dim DatesRange As Range Dim i As Integer Dim TransposeThis As Range Dim LastCol As Integer If WorksheetFunction.CountA(Cells) > 0 Then LastColumn = Cells.Find(What:="*", After:=[A1], _

How to plug a range object into a formula

别说谁变了你拦得住时间么 提交于 2020-02-15 08:07:27
问题 I want to plug a range object into a formula. An example should look roughly like this: Dim x As Range Set x = Range(Cells(1, 1), Cells(2, 1)) Range("C1").Formula = "=SUM(" & x & ")" The result should be "=SUM(A1:A2)" in cell C1. The point is to plug the the range object into a formula. I used SUM as an example, the real formula is more complicated. I guess there is an easy answer to this, e.g. some method for a range object, but I have't found it after some pondering ... Thanks in advance,

How to plug a range object into a formula

跟風遠走 提交于 2020-02-15 08:07:19
问题 I want to plug a range object into a formula. An example should look roughly like this: Dim x As Range Set x = Range(Cells(1, 1), Cells(2, 1)) Range("C1").Formula = "=SUM(" & x & ")" The result should be "=SUM(A1:A2)" in cell C1. The point is to plug the the range object into a formula. I used SUM as an example, the real formula is more complicated. I guess there is an easy answer to this, e.g. some method for a range object, but I have't found it after some pondering ... Thanks in advance,

How do I bring focus to a msgbox?

别等时光非礼了梦想. 提交于 2020-02-15 00:48:32
问题 Private Sub CommandButton1_Click() Dim i As Long Dim xreply As Integer Dim names As Long Dim IE As Object i = ActiveSheet.Range("D1").Value While Not IsEmpty(ActiveSheet.Range("A" & i).Value) Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate "WEBSITENAME" & ActiveSheet.Range("A" & i).Value 'wait for webpage to load Do DoEvents Loop Until IE.READYSTATE = 4 'pagedown to the info Application.SendKeys "{PGDN}", True Application.SendKeys "{PGDN}", True xreply =

Inserting an Image into a sheet using Base64 in VBA?

半城伤御伤魂 提交于 2020-02-11 07:52:26
问题 I'm trying to insert an image into a sheet with VBA using Base64 but I can't find any examples of how to do it correctly anywhere. I have a string setup for the image, something like: vLogo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZoAAABfCAY" I just want to do the following, but instead of looking for an image file store the image in the VBA. Sheets("Sheet1").Pictures.Insert (Application.ActiveWorkbook.Path & "\vLogo.png") I've even looked at doing something like: ' Write the image

Add page break every x rows after specific value excel vba

依然范特西╮ 提交于 2020-02-08 09:11:24
问题 I'm having a hard time to figure out how to combine two macros I have (see below). What I would like to achieve is to automatically insert a pagebreak every (lets say) 80 rows. Now comes the part that I can't seem to manage. After every 80 rows it will search up to the first specific search value "total" in column H and add the page break, so the pagebreak in row 80 can only change to less (e.g. row 75). The thing is that in the range of 80 rows there are multiple "total". So it must search

List all sheets with link

天大地大妈咪最大 提交于 2020-02-08 08:34:25
问题 How can create a index for all sheets automatically, I have a lot customers, with a sheet for each customer. I also want to show some of the data in index of all the sheets. see images 回答1: Loop through the sheets creating a link for each. This will list them starting at the active cell. Sub CreateLinksToAllSheets() Dim sh As Worksheet Dim cell As Range Dim strLink As String For Each sh In ActiveWorkbook.Worksheets If ActiveSheet.name <> sh.name Then strLink = sh2.name If InStr(strLink, "'")

How to have my loop range be changing based on conditions

强颜欢笑 提交于 2020-02-08 03:51:52
问题 i don't know if my problem description is accurate, but basically i have this: Since I'm working with positions here, each position comes in a pair. I want to loop through the whole list down and calculate the difference in value in each position pair (so i want to find the loss or the gain), and return it to another cell. here the difference between the 1st position pair is 14688, the following is another position. I've done a short code here to try to get the logic right, but it definitely