excel

Convert String to Excel Date and Time, with specific string format

不羁岁月 提交于 2021-02-07 14:15:13
问题 I've got an Excel/VBA macro which list files in a directory. Filenames are in format : yyyy-MM-dd@hh-mm-ss_[description].csv for instance : 2013-07-03@22-43-19_my-file.csv I then need to get the first part of the filename into an Excel Date object (including a Timestamp) I found the CDate() function, but it doesn't take any "format" parameter, and the Format() function works the wrong way, ie to convert a String to a Date. I'd like to get a function with takes a String and a format, and

Convert String to Excel Date and Time, with specific string format

时光毁灭记忆、已成空白 提交于 2021-02-07 14:13:16
问题 I've got an Excel/VBA macro which list files in a directory. Filenames are in format : yyyy-MM-dd@hh-mm-ss_[description].csv for instance : 2013-07-03@22-43-19_my-file.csv I then need to get the first part of the filename into an Excel Date object (including a Timestamp) I found the CDate() function, but it doesn't take any "format" parameter, and the Format() function works the wrong way, ie to convert a String to a Date. I'd like to get a function with takes a String and a format, and

How to transpose sheet with POI SS/XSSF?

青春壹個敷衍的年華 提交于 2021-02-07 13:48:03
问题 I am using POI XSSF API and I would like to transpose a sheet. how can I do that? Thanks. 回答1: Transpose, as in swap A2 with B1 and A3 with C1 (so columns become rows)? If so, there's nothing built in, so you'd need to do a little bit of coding yourself. You'd likely want to grab a pair of cells, save the contents of one (value and style), copy the second to the first, then overwrite the second. See the quick guide if you're not sure on all the reading/writing parts. 回答2: I was looking for

How to transpose sheet with POI SS/XSSF?

浪子不回头ぞ 提交于 2021-02-07 13:46:27
问题 I am using POI XSSF API and I would like to transpose a sheet. how can I do that? Thanks. 回答1: Transpose, as in swap A2 with B1 and A3 with C1 (so columns become rows)? If so, there's nothing built in, so you'd need to do a little bit of coding yourself. You'd likely want to grab a pair of cells, save the contents of one (value and style), copy the second to the first, then overwrite the second. See the quick guide if you're not sure on all the reading/writing parts. 回答2: I was looking for

Can I make a structured reference absolute in excel 07?

我只是一个虾纸丫 提交于 2021-02-07 13:38:42
问题 I have a table "A" with 2 columns "Foo" and "Bar". I have a formula with the structured reference A[Foo]. When I fill this formula horizontally I want the reference to stay A[Foo] but now, in the second column, the reference turns to A[Bar]. Is there a way to make this structured reference absolute? It'd be shocking that this isn't supported if not. Example Formula: =A[Foo] Drag that horizontally and Foo changes if the table has multiple columns 回答1: there is a difference between copying and

Using ranges, how can I make a .COPY DESTINATION paste as VALUES

萝らか妹 提交于 2021-02-07 13:37:44
问题 I have the following code, which works just fine to copy the entire cells to their new destination. Dim ws As Worksheet, rng As Range Set ws = Sheets("Duplicates") Set rng = ws.Range("A2") rng.Copy Destination:=Range("A2:A" & Range("G" & Rows.Count).End(xlUp).Row) Is it possible to make that cope a paste special . Or do I need to split the copy/paste into two lines using a two range objects? EDIT: Right, we've concluded that you CANNOT have a paste special on the same line as a copy. What I

Call Powershell Script from VBA(with Parameter)

感情迁移 提交于 2021-02-07 13:25:44
问题 I want to call a Powershell-Script from Excel VBA and pass 1 Parameter. Without VBA the Script works perfectly and does what it supposed to do.. As soon as the Call works, i would like to add 1 parameter, but first the successfull call... But i cant manage to call it within Excel VBA. First ill show you my Powershell-Script: #param([string]$server) $server = "chvmes01" $BasicPath = Split-Path $script:MyInvocation.MyCommand.Path write-host $BasicPath Invoke-Command -FilePath $BasicPath

What is a public object module in VBA?

自作多情 提交于 2021-02-07 12:44:08
问题 I'm trying to get as close to function pointers / abstract classes as I can in VBA. I have a class called VerificationManager and verifies a bunch of cells in a couple of spreadsheets match up. This will be done in different ways depending on the information and spreadsheets being used with it. I'd like to be able to make the code reusable by specifying a method to be called in a string using the Application.Run function. So I can rewrite the function that changes. Now if I was using Java or

Print a variable's name

£可爱£侵袭症+ 提交于 2021-02-07 12:25:20
问题 I might be bad at googling as I couldn't find the answer to below question: Sub TEST() Dim sthstring as string sthstring = "Hello World" end sub While we all know it's easy to use msgbox to print "Hello world" , is it possible to print out the variable's name (which in this case, "sthstring" ) and how? EDIT: please do not provide with answer such as: Dim someotherstring as string someotherstring = "sthstring" as I meant to find a way to print the 'name' of the variable, thanks 回答1: After

AttributeError: 'ElementTree' object has no attribute 'getiterator' when trying to import excel file

天涯浪子 提交于 2021-02-07 11:29:35
问题 This is my code. I've just installed jupyterlab and i've added the excel file in there. Same error if i change the path to where the file is on my system. I can't seem to find anyone who had the same problem when simply importing an excel file as a dataframe. The excel file is a 3x26 table with studentnr, course, result columns that have values like 101-105, A-D, 1.0-9.9 respectively. Maybe the problem lies with the excel file? Either way i have no idea how to fix this. import pandas as pd