excel

Reading LBR (xml) as TXT in Excel vba

本秂侑毒 提交于 2021-02-11 15:50:47
问题 I'm trying to read a .LBR extension file (XML language) in Excel with this code: Dim X As Double Dim TXT As String Open "C:\Users\Asus\Desktop\Test\OJE-SS-124HM_000.lbr" For Input As #1 X = 1 Do While Not EOF(1) Line Input #1, TXT Worksheets("LBR").Cells(X, 1) = TXT X = X + 1 Loop Close #1 But I'm getting the entire text just in the first cell A1, see the bottom image. I'd like to get each text lines in separate cells, A1, A2, etc. What am I doing wrong? I think the LBR file doesn't have a

VBA to transpose data based on empty lines

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-11 15:48:20
问题 I have an EXTREMELY large data set in excel with varying data sets (some have 12 lines and some with 18, etc) that are currently in rows that needs to be transposed to columns. All the groupings are separated by a empty/blank line. I started the VBA to transpose this it but dont know how to include/look at the blank line and loop it to the end of each sheet. Any ideas/suggestions? Range("F1:F12").Select Selection.Copy Sheets("Sheet4").Select Range("A1").Select Selection.PasteSpecial Paste:

VBA to transpose data based on empty lines

跟風遠走 提交于 2021-02-11 15:47:22
问题 I have an EXTREMELY large data set in excel with varying data sets (some have 12 lines and some with 18, etc) that are currently in rows that needs to be transposed to columns. All the groupings are separated by a empty/blank line. I started the VBA to transpose this it but dont know how to include/look at the blank line and loop it to the end of each sheet. Any ideas/suggestions? Range("F1:F12").Select Selection.Copy Sheets("Sheet4").Select Range("A1").Select Selection.PasteSpecial Paste:

Convert JSON to Excel by Python

不羁岁月 提交于 2021-02-11 15:46:37
问题 I have a JSON that need to convert to Excel. I'm using Python 3.8 with xlsxwriter library. Below is sample JSON. { "companyId": "123456", "companyName": "Test", "companyStatus": "ACTIVE", "document": { "employee": { "employeeId": "EM1567", "employeeLastName": "Test Last", "employeeFirstName": "Test Fist" }, "expenseEntry": [ { "allocation": [ { "allocationId": "03B249B3598", "journal": [ { "journalAccountCode": "888", "journalPayee": "EMPL", "journalPayer": "COMP", "taxGuid": [ "51645A638114E

Excel VBA: Copy rows from another workbook, but just the function results

一笑奈何 提交于 2021-02-11 15:45:54
问题 I want to copy 10 rows from a workbook into a new workbook. The copy & paste is fine, but in the copied cells are some formulas that I need to replace with the results. Is there a magical way to copy only the displayed values from the cells? This is how I do it now: Rows("2:11").Select Selection.Copy myWorkbook.Sheets(1).Activate ActiveSheet.Rows("1:10").Select ActiveSheet.Paste 回答1: Rows("2:11").Copy myWorkbook.WorkSheets(1).Rows("1:10").PasteSpecial xlPasteValues Application.CutCopyMode =

Convert JSON to Excel by Python

时光怂恿深爱的人放手 提交于 2021-02-11 15:45:13
问题 I have a JSON that need to convert to Excel. I'm using Python 3.8 with xlsxwriter library. Below is sample JSON. { "companyId": "123456", "companyName": "Test", "companyStatus": "ACTIVE", "document": { "employee": { "employeeId": "EM1567", "employeeLastName": "Test Last", "employeeFirstName": "Test Fist" }, "expenseEntry": [ { "allocation": [ { "allocationId": "03B249B3598", "journal": [ { "journalAccountCode": "888", "journalPayee": "EMPL", "journalPayer": "COMP", "taxGuid": [ "51645A638114E

Excel VBA: Copy rows from another workbook, but just the function results

跟風遠走 提交于 2021-02-11 15:44:29
问题 I want to copy 10 rows from a workbook into a new workbook. The copy & paste is fine, but in the copied cells are some formulas that I need to replace with the results. Is there a magical way to copy only the displayed values from the cells? This is how I do it now: Rows("2:11").Select Selection.Copy myWorkbook.Sheets(1).Activate ActiveSheet.Rows("1:10").Select ActiveSheet.Paste 回答1: Rows("2:11").Copy myWorkbook.WorkSheets(1).Rows("1:10").PasteSpecial xlPasteValues Application.CutCopyMode =

Unique range in Excel doesn't return the unique record but all other records

牧云@^-^@ 提交于 2021-02-11 15:42:12
问题 I have got a problem with the unique value in Excel. I used the advice from this query: Extract unique value from the range in Excel used the following module: Public Function unikue(rng As Range) Dim arr, c As Collection, r As Range Dim nCall As Long, nColl As Long Dim i As Long Set c = New Collection nCall = Application.Caller.Count On Error Resume Next For Each r In rng c.Add r.Text, CStr(r.Text) Next r On Error GoTo 0 nColl = c.Count If nCall > nColl Then ReDim arr(1 To nCall, 1 To 1) For

How to select the first visible row after applying a filter

僤鯓⒐⒋嵵緔 提交于 2021-02-11 15:35:25
问题 I'm filtering a table in Excel but I only want the first line that appears. 回答1: Use Range.SpecialCells method with the xlCellTypeVisible parameter on the filtered range. .Rows(1).Cells should be what you want. Sub first_row() Dim rFirstFilteredRow As Range With Worksheets("Sheet1") With .Cells(1, 1).CurrentRegion 'do all the .autofilter stuff here With .Resize(.Rows.Count - 1, .Columns.Count).Offset(1, 0) If CBool(Application.Subtotal(103, .Cells)) Then Set rFirstFilteredRow = _

how to write an if statement code to compare two cell's value in one sheet to another cell in another sheet

孤街浪徒 提交于 2021-02-11 15:35:14
问题 i have two columns (Start Date, End Date) and i want a code that changes the color of both their cells to red if the start date and end date contained any date located in another sheet I tried using conditional formatting using this rule: =AND(C2<=Holidays!$A$2:$A$15,D2>=Holidays!$A$2:$A$15) 回答1: Tested out the below formula for myself and think it should work! Effectively rather than a simple AND statement, since we're comparing against an array of values rather than single cells, we need to