"unknown error" on vba script
Any idea why I get "unknown error" on line 32?
- Option Explicit
- Sub updateCSV()
- Dim wb As Workbook
- Dim ws As Worksheet
- Dim newWS As Worksheet
- Dim i As Long
- Dim z As Long
- Dim lr As Long
- Dim desc As Variant, created As Variant, amt As Variant, fee As Variant
- 'Set Objects
- Set wb = ActiveWorkbook
- Set ws = wb.ActiveSheet
- Set newWS = Sheets.Add
- 'Vars -> Assumes headers are in row 1
- desc = Application.Match("Customer Description", ws.Rows(1), 0)
- created = Application.Match("Created (UTC)", ws.Rows(1), 0)
- amt = Application.Match("Amount", ws.Rows(1), 0)
- fee = Application.Match("Fee", ws.Rows(1), 0)
- z = 1
- 'Format newWS
- With newWS
- .Cells(1, 1).Value = "description"
- .Cells(1, 2).Value = "date"
- .Cells(1, 3).Value = "Amount"
- End With
- 'Get data from ws
- With ws
- lr = .Cells(.Rows.Count, 1).End(xlUp).Row
- 'Assumes data starts at row 2 and headers are on row 1
- For i = 2 To lr
- z = z + 1
- newWS.Cells(z, 1).Value = ws.Cells(i, desc).Value
- newWS.Cells(z, 2).Value = Format(ws.Cells(i, created).Value, "mm/dd/yyyy")
- newWS.Cells(z, 3).Value = ws.Cells(i, amt).Value
- Next i
- 'Add values back
- For i = 2 To lr
- z = z + 1
- newWS.Cells(z, 1).Value = "stripe fee: " & ws.Cells(i, desc).Value
- newWS.Cells(z, 2).Value = Format(ws.Cells(i, created).Value, "mm/dd/yyyy")
- newWS.Cells(z, 3).Value = ws.Cells(i, fee).Value * -1
- Next i
- End With
- 'Fit
- newWS.Columns.AutoFit
- End Sub
Sticky Posts
Slicers are now available in Zoho Sheet—filter your data interactively
At Zoho Sheet, we diligently track user requests and feedback. In line with this, based on extensive user requests, we've integrated Slicers to pivot tables and are delighted to announce its release. Slicers are interactive visual filters that have add,
Check out the new Checkbox in Zoho Sheet
Checkbox, the simple GUI widget that lets you choose between two mutually exclusive options i.e Yes or No, is now in Zoho Sheet. Having made it across the web, Checkbox is familiar but is still elusive to most spreadsheet software. Special developer ribbons, macros and all other complexities to add a checkbox to a spreadsheet? Not in Zoho Sheet. How to add Checkbox to Zoho Sheet? Adding a Checkbox in Zoho Sheet is simple. Select a cell/range and choose "Checkbox" in "Input Controls" under the Format
Format and analyze spreadsheet data with Zoho Sheet's Table
While a spreadsheet helps you compile data for easy analysis, formatting helps make your data more comprehensible. We are happy to announce the release of Table, a crucial tool for improving data formatting in Zoho Sheet. More than a formatting tool,
Introducing Data Bars: Graphically represent changes in data within the cells
Conditional formatting has helped millions of spreadsheet users analyze and highlight their data more efficiently. In addition to the classic rules, color scales, and icon sets available in Zoho Sheet, you can now apply Data Bars, a convenient method
Zia in Zoho Sheet now makes suggestions on conditional formats, picklists, and checkboxes
Zia, Zoho's popular AI assistant, has been helping users succeed across Zoho applications since inception. In Zoho Sheet, Zia helps users efficiently build reports and analyze data with recommendations about data cleaning, charts, and pivot table. Also,