excel-vba

Copying rows into one cell VBA [duplicate]

耗尽温柔 提交于 2020-01-03 05:32:27
问题 This question already has answers here : How to merge rows in a column into one cell in excel? (9 answers) Closed 3 years ago . I've a worksheet with various values in only one column like: A B C D E F ... And I need a write a simple code that will put this all together in one cell (for example D2) and that cell I want to have a value: A;B;C;D;E;F;... I think it's quite easy, but I'm too ill to think about it, would you help? :( 回答1: In a simple form, the following VBA macro can do the job

Import multiple text files to a new row in excel using vba?

牧云@^-^@ 提交于 2020-01-03 05:20:53
问题 I have the following code which scans my directory for text files. In my directory there are several text files each laid out like so: Text File: Birmingham France Isle of White Manchester New-Castle I am then trying to import each text file to a new row in excel and so that each line of text is inserted into a new column within that row. Birmingham France Isle of White Manchester New-Castle The code I have does this, however it is only importing one text file and is not importing all of the

Rip data from Power Pivot (“Item.data”)

懵懂的女人 提交于 2020-01-03 05:20:11
问题 I have received a workbook which contains two tables in power-pivot (one around 1 mill rows, another 20 mill rows). I would like to rip this out (as anything really - but let's say a CSV) so that I can use it in R + PostGreSQL. I can't export to an Excel table as there are more than 1 million rows; and copy-pasting the data only works when I select around 200,000 rows. So I'm a bit stuck! I tried converting the xlsx into a zip and opening the "item.data" file in notepad++, however it was

Populating a combobox in Word from Excel - stops working after Excel file is moved

梦想的初衷 提交于 2020-01-03 05:15:14
问题 Thanks for your time! Using snippets of code gathered here on stackoverflow and elsewhere, I was able to cobble together a macro that will populate a combobox in Word from a defined range of data in an Excel file, and then get a label to print the second column from the combobox (which is too long to display in the combobox itself). So far, so good. Here's my code: Private Sub ComboBox1_DropButtonClick() 'Late binding. No reference to Excel Object required. Dim xlApp As Object Dim xlWB As

Different result from match search and check directly cell()

大兔子大兔子 提交于 2020-01-03 05:12:51
问题 For the below problem I mistakenly asked for a review in C.R., but they told me not to be the right place, so I extend to you the same question. I cannot find answers alone. this very simple code return 2 different results, why ?!?! I'll be crazy... Function FirstDay(t As String) As Boolean d = DateSerial(Left(t, 4), Mid(t, 5, 2), Right(t, 2)) - 1 FirstDay = False Var = Application.Match(d, Worksheets("Diary").Columns(1), 0) If Not IsError(Var) Then FirstDay = True End If 'this only to check

Print Variable Array of Specific Worksheets to a Single Printout

你离开我真会死。 提交于 2020-01-03 05:08:33
问题 I would like to print specific worksheets from my Excel workbook to a single printout. There are additional sheets in my workbook that should not print. The name of the first worksheet to be printed will be constant ("Recipe"). The names of the other worksheets to be printed will vary (they will all have the prefix "Pie" and different suffixes). The number of sheets to be printed will vary from project to project. For example, In project #1 the workbook will include the following worksheets:

How to direct jump on specific Cell in Excel

こ雲淡風輕ζ 提交于 2020-01-03 04:52:04
问题 Good Morning/Afternoon/Evening to all :) My First time on here so.................... :) Spreadsheet Example I use this code in "Conditional Formatting" =AND(ISNUMBER(SEARCH($B$3,A6)),$B$3<>””) so i only able to highlight the cell as on Screenshot (Whenever type text on B3 it's automatically highlight the contain Cell as on Screenshot) but what I want is it's only highlight the cell but cannot jump (select) cell when i type ""text"" on Search B3 box. For Example: On Screenshot I type DW353

Read and change multiple XML files in Excel (2007) VBA

时光怂恿深爱的人放手 提交于 2020-01-03 04:49:05
问题 I'm trying to read a folder full of XML files and change the reference number into a specific format which is Today's DATE(yymmdd), Initials, 8 digit reference starting at 00000001 e.g 120815AB00000001 then 120815AB00000002 etc. Each file has ONE reference number. It is enclosed in the < CPAReferenceNumber> tag. I'm using Excel and VBA to read the files and change the relevant field. The reference is set to a default value (in the code below it changes 'This' into 'That' for now) This code

Use VBA to copy all visible and non-empty cells in a range

淺唱寂寞╮ 提交于 2020-01-03 04:32:14
问题 After filtering, I want to copy all visible and non-empty cells (the cells which contain text). For some reason, my current code isn't working. Any help would be greatly appreciated. Thanks! Sheets("Sheet1").Range("S2:S5000").SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeConstants).Copy 回答1: Full admission that I did not try your code, but you can also try the following With Sheets("Sheet1").Range("S2:S5000") Application.Intersect(.SpecialCells(xlCellTypeVisible), _ .SpecialCells

Open Sharepoint Excel Files With VBA

邮差的信 提交于 2020-01-03 04:30:08
问题 I'm using VBA in Excel to loop through files on a sharepoint site and open all Excel files. The code crashes Excel the first time I run it, however, if I then reopen it it works fine. Are there any known issues around this? Thanks. Edit: Here is the code: Sub Refresh() With Application .ScreenUpdating = False .DisplayAlerts = False Dim fso As FileSystemObject Dim fldr As Folder Dim f As File Dim wb As Workbook Set fso = New FileSystemObject Set fldr = fso.GetFolder(SharePointSite) For Each f