Using a UserForm to Populate Rows in Excel - excel

I would like the users of this file to copy a list of what we call "family codes" into a UserForm and then when they click a button on the UserForm, this list of family codes will populate a column in Excel. See below for exactly what I envision. Mostly, I just can't find a specific UserForm that can handle this, but I welcome any better ways to do this as well.
Example of "family codes": AS10, AS08, AS06, B137 -- These are always four digit letter/number combinations
Step 1:
User takes a list such as this that they want to use in the file:
AS10
AS08
AS06
They would copy these family codes vertically, as they are stored in separate rows in excel (ex. they would copy these families out of cells "A2:A4".
Step 2: The user pastes the vertical data into a UserForm
Step 3: The user clicks a command button on the userform and a macro pastes these families into cells "D2:D4" in vertical order in separate rows.

Wow I feel like an idiot... All I needed to do was change the "MultiLine" setting of the TextBox to true instead of false. Now I can paste in vertical data and pull it out.
Only hope is someone else with the same issue might discover my question before spending too much time!

Related

How to have content shown next to a table with hidden rows excel

I have a table with dropdowns that will hide certain rows. To the right of this table, I want to have some content, but can't do this as it will be hidden when these dropdowns are selected. I currently have the content to the bottom right of the sheet and have tried splitting the screen to have them both showing but this does not work either. Any ideas on how I can have the two showing side by side? Thanks!
I've gotten around this by using Text Boxes. After creating the text box, change the properties to "do not move or size".
In the picture below, there are two text boxes.
-- The first one is just static text that you copy/paste in there. This works fine as long as you have the same info displayed all the time.
-- The second one has the ability to be somewhat dynamic, where it references the contents of another cell. That cell can be anywhere (this sheet, another sheet, doesn't matter). So in this example...
Cell L1 formula: =TEXTJOIN(CHAR(10), TRUE,E1:E3)
Textbox formula: =Sheet4!L1
No matter how you filter/hide, those text boxes won't move.

Insert Table header Row when column value changes

I have a table of overdue customer invoices. Each customer could have several overdue invoices and I want to collate these into separate customer tables, with a sum total of due amount.
I want this to be in one worksheet, with the header row above each customer table.
Therefore, I'm looking for a VBA macro that will go through the data in column A and when it sees a change, from one customer number to the next, it totals up the values for that customer and inserts the header row, ready for the next customer. And continues on...
Example sheet Here
Sheet(tab)1 shows raw data, sheet2 shows how the formatted data should look.
I'm stumped sorry and any help or direction appreciated. Hope the info is clear.
To get started I suggest you search google "creating vba macros read and write column"
Are you familiar with VBA macro? If not, you could use a combination of index, and match formula.
Otherwise VBA solution logic, in VBA editor - which is accessible by Alt +F11:
Click on the sheet you want your VBA code to apply to and start writing your function. For example a function to check a cell range called "myFunction" would be as follows,
A single example:
Sub myFunction ()
If range.("A1").value = "Customer1" then
Range("B1:E1").Insert([Shift], [CopyOrigin])
end If
Sub End
More work required to check condition on event, dynamic insert, and will need to be wrapped in a loop. The below are tutorials specific to the job you need to program your macro for.
VBA copy and paste code if condition is met tutorial here : https://youtu.be/qGZQIl9JJk4
VBA insert tutorial here : https://powerspreadsheets.com/excel-vba-insert-row/#Excel-VBA-Constructs-to-Insert-Rows
VBA How to SUM Totals At Bottom of a Column Dynamically : https://youtu.be/_0Vcnb3xdOM
The first question is-- What VBA have you tried?
Next, change col A heading to Customer, and col E heading to Amount
because these are the desired output headings .
Next, did you know that by dropping down View, and then Macros,
that there is a RECORD button? Click it.
Finally, it records your pressing Insert / PivotTable on a New sheet.
Drag the Amount field down to the Values box
After you drag each of the other fields to the Rows box,
left click on it in the Rows box, and select FieldSettings --
Subtotals tab -- Automatic for Customer, None for the others
Layout tab -- Show item labels in tabular form for each field
and just for Customer field--Insert page break after each item
At the end, click on any cell of the pivot, select PivotTableOptions --
Totals&Filters tab -- unclick Column totals
Click PageLayout,
then Margins -- make them narrow
then Sheet -- Rows to print at the top
Maybe Header -- Custom Header
Finally click on View / Macro
StopRecording
Presto, now the VBA has been captured.
Ok, so all you have to do is insert a Subtotal. Check out these screen shots.
Before:
After:
Depending on which version of Excel you are using, would probably determine how to navigate to the Subtotal button. Google for that, if you can't fine it. Should be super-simple.

Excel "true-false" to checked boxes

I have an Excel spreadsheet that I'm generating from a SharePoint dashboard. It's turning my checkboxes in the SharePoint table to "true" or "false" values in the Excel spreadsheet. I wanted to know if it is possible to turn those "true" or "false" values back into checked boxes, with the appropriate check or uncheck option selected.
Any help at all is appreciated!
I strongly advise against using check boxes in Excel if you already have the data as TRUE/FALSE in a cell. Check box controls are meant to be for user forms, and even though they can be placed in the spreadsheet grid, they live in a layer on top of the spreadsheet. Yes, they can be linked to a spreadsheet cell, but this is cumbersome.
Instead of using a macro that inserts a check box for each data row you could use a helper column with a formula along the lines of
=IF([#checkBoxField],"a","r")
Then format the helper column with the Marlett font, which will show the letter "a" as a tick and the letter "r" as a cross.
Applying a formula like this will be much faster than inserting check box controls into each row and linking them to the field cells.
You can add a checkbox over a given cell, then edit its properties (Format Control --> Control Tab) and set its Cell Link property to the address of the cell; i.e. "B2". If you have too many such boolean cells, the task is tedious so you might need to automate it with VBA.
p.s. I agree with #teylyn that this shouldn't be a good choice if you have a huge column of boolean data; it adds too many shapes which is cumbersome. You should use it if the number of boolean cells is rather limited.

Excel: Return the last entries from a list of entries

Please excuse me for the wording of the title. Not sure exactly how to word this so it's probably best to just show.
I have a list that looks like this
Name Date Updated
==== ===========
Item 1 1/1/2015
Item 2 1/2/2015
Item 3 1/3/2015
Item 2 1/4/2015
Item 3 1/5/2015
Item 1 1/6/2015
This will be an ongoing list. As items are updated they will be entered in like this. I would like to create a second sheet that gives me the last date that each item was updated. So the result based on the above table would look like this.
Name Date Updated
==== ===========
Item 1 1/6/2015
Item 2 1/4/2015
Item 3 1/5/2015
I have found a few solutions on the web that work when I first input the formula (Links below), BUT when I add more entries in the first table the results wont update or they'll show the wrong data.
Links:
http://blog.contextures.com/archives/2014/02/04/find-last-item-in-group-with-index-match/
http://www.get-digital-help.com/2014/02/07/find-last-matching-value-in-an-unsorted-list/
Thanks in advance for any help.
You can simply omit the numbers in the formula to get the whole column:
=INDEX($C:$C,MAX(($E$3=$B:$B)*MATCH(ROW($B:$B),ROW($B:$B))))
(following the formula from your second link).
You can record a macro as you do it manually one time. Then assign that macro to a button. Then click the button anytime you need the sheet updated.
Steps:
Start on a sheet other than the one with the data. Explanation in #3 below.
Start recording your macro by going to View > Macros > Record Macro. In the bottom left you'll now see a square stop button for when you want to stop recording.
Select the sheet with the data. This way the macro will always remember to select the right sheet regardless of where you are.
Select the two-column range of cells that has your data, then continue selecting a few hundred rows down, or at least well beyond where you think your data will eventually go down to.
Copy
Select the sheet where you want to have the summarized data.
Paste
Sort by name (ascending) and date (descending) all at once (rather than two operations). Do this by going to the Data tab in the ribbon and selecting the white and blue sort button that has two A's and two Z's and says "Sort".
With this pasted and sorted range still selected, remove duplicates in the name column. To do this, do not change the selection. Go to the Data tab and select Remove Duplicates.
Now your items will appear once and the date will be the most recent date.
Click the "stop recording" square blue button in the bottom left to stop recording your Macro.
You can assign this macro to a button or to a shortcut. To add a button you need to show the developer tab and then draw the button using one of the options on the developer tab. I can't remember offhand how to show the developer tab. Once you have a button, right click and assign the macro to the button.
13A. If you want to customize the macro, click ALT+F11 to get to the visual basic editor. Double click on one of the things named something like "module" on the left and you can edit your the range in your macro, for example if your data suddenly goes down 100 more rows than what you planned and you want the macro to cover it. Save with CTRL+S. The next time you run your macro, it will reflect these changes.
13B. View > Macros to edit your macro if you want to assign a shortcut key to it instead of adding a button.
Try all this with a copy of your spreadsheet so that you don't delete data by accident.
Does it work for you?
You could easily do this with a Pivot Table. Drag Item to Rows area and Dates to the Values area. Then format the values as Date, and select to return Max.

Is there a way to transfer MSWord numbering bullets to MSExcel column?

I have been using MSWord 2010 to compose list of questions. These questions are organized in single MSWord document, using numbering - 1. first question, etc...
I was wondering could contents of each bullet be transffered to MSExcel cell? So if i have 20 questions, i would have cell with 20 rows, each containing one question.
I am asking this because i have 300 questions that i want to import to excel.
It's possible to copy your numbered bullets from Excel to Word and then break them up using Excel worksheet functions. However, it's real easy to just do it with the built-in Excel commands.
In Word:
Increase the width on the hanging indent on your numbered list. It will make the conversion in Excel easier to deal with.
Select your bullets and copy them.
In Excel:
"Paste Special" the copied text into Excel using the Match Destination Formatting option.
Select the cells you pasted the bullets by the number of digits in the bullets (i.e., first do 1-9, then do 10-99, etc.)
With the cells selected, choose the Text to Columns command from the Data tab on the ribbon.
Make sure that the 'Fixed Width" radio box is selected on the dialogue box that comes up, then move to the next step.
Adjust the break lines so that there are three fields: one with the number + period, another the spaces between the numbers and text, the third the text.
Moving to the next step - select the second field (the spaces) and click the "Do not import column (skip) radio button.
Click finish and the bullets are imported.
The above answer is best if you have an already established list. The best workflow I've found for this is to create a table to work in, in word. That table then copies perfectly into cells in excel, allowing you to create a structure that will pass between the tow docs seamlessly.

Resources