excel vba - transferring multiline cell content to multiple rows - vba

In Excel, my requirement is to transfer multiline cell content to multiple rows. I have attached some sample input data and output data. Please let me know on how to proceed. Thanks in advance.

Select column "name" then use Ctrl+G->bank->type "=" then hit down arrow and Ctrl +Enter-> all blank cells will be filled as shown as ur output data ( unmerge first if column "name" contains merged cells )

Related

How to create hyperlinks in VBA for mutiple cells?

I have to create hyperlinks for a list of variables to get easily to the datas in a database. My database contains summary of many variables coming from different sources. My problem is, I have to skip multiple rows fill with duplicates and blank cells. The number of rows to skip depends for every variable. I also want that my hyperlinks have the name of the variable from the database (example : Customer_Since). Is there a way to create a loop to skip the good number of rows and create a hyperlink? Example : if I click on the link named Customer_Since, it takes me to the row that contains the summary of the variable Customer_Since. Can somebody help me?
To create a hyperlink you can use this code:
ThisWorkbook.Sheets("SheetName").Hyperlinks.Add Anchor:=Range("A10"), Address:="", SubAddress:="Sheet2!B5", TextToDisplay:="Link"
where:
Anchor - cell, where there will be a hyperlink;
SubAddress - range to navigate to;
TextToDisplay - text in the link.
You can use another vba code with your rules to correctly insert Anchor`s range.
Or please provide more information and examples of the input and output data to get help.

Excel VBA; Search rows grabbing values and pasting them into another worksheet

I have two workbooks;
(WB1) with two sheets; "Input" and "Output"
and
(MacroWB) with the macro and a "Column Header" list.
Example file: "Messy" sheet = input, "Organized" = output
https://drive.google.com/file/d/0B-leh2Ii2uh9bDBFbDBHbGcxbUU/view?usp=sharing
I need help coding a macro to do the following:
1) Create a loop to go through each row of the "Input" sheet searching for values matching cells in the "Column Header" list.
2) When a matching value is found; take the data from the cell immediately to it's right (in the "Input" sheet) and paste it into the corresponding column of the "Output" worksheet.
3) Once every "Column Header" item has been searched/pasted for that row; move to the next row of the "Input" sheet. Rinse and repeat until all rows of the "Input" sheet have been searched/pasted.
Here is an example, the letters are to be column headers and the numbers are to be copied to the appropriate "Output" sheet column.
https://drive.google.com/file/d/0B-leh2Ii2uh9TXRGTnFDRU1jY0U/view?usp=sharing
Keep in mind that the actual data file has ~50 columns and ~3000 rows.
Also that the data is not all Letter/Numbers like the table above, it is more like the data in the linked .xlsx file.
If there is anything I haven't been clear about, please ask and I will try my best to clarify. Also I may be WAY over thinking this, if so.. please let me know.
THANK YOU ANYONE THAT CAN GET ME GOING IN THE CORRECT DIRECTION!!!
-Joe
Skip the the VBA and use Text to Columns the Data tab. I'malways copying html and its works 99% of the time. If the html is pretty and properly formated you may get away with using the fixed width option, otherwise gor for the delimted and choose "tab". If tab doesn't work try using spaces, assuming that your cells don't contain spaces.
The other option that I've had work on rare occasions that text to columns doesn't is simply saving the text in word and saving as rtf and then opening that in notepad++ (which everyone should have.) Copy from ++ to excel and that usually fixes the problem.
EDIT: If you right click before pasting and click "paste special" this regularly helps with html pasting.
In your sample file, I used the following formula in A2 of Organized sheet (assumed 50 as max columns in Messy):
=IFERROR(OFFSET(Messy!A1,0,MATCH(Organized!A$1,OFFSET(Messy!A1,0,0,1,50), )),"")
Dragging it to H11 produced the following result:
The sample data is not complete, and some 'tags' in Messy sheet are not consistent (SiteID vs SITE_ID), but it should help you get started.

How to insert the contents of a text file into the excel sheet cell by cell?

I have a text file with lots of 3-digit numbers delimited by space.Now I would like to place each number from the text file into each cell in the excel sheet moving row-wise. And once the
first row is filled, the numbers should be inserted in the cells of the second row.
I tried with the 'Get External Data' From Text option under Data Tab of Excel 2007. It displays a message "The file contains more data than will fit on a single worksheet". On clicking "Yes" to import data as much it fits, the numbers are displayed in each cell of a single row until the cell XFD1. Why the numbers are not displayed in the next next rows of the sheet?
Please suggest me on how to go about achieving this.
swap the spaces with either:
Commas (,), Semi-colons(;) or tabs
to separate into columns
use
enter/return
to separate into rows
then open the file as CSV.

Getting display text as ###### for some of the cell in excel after writing from Vb.net code

I am writting to an excel file from my vb code. The code goes as below
xlsheet3 = xlBook.Sheets.Add(After:=xlSheet)
With xlsheet3
.Columns(5).NumberFormat = "#"
.Cells(j + 1, 5) = someStringValue 'Here "j" is a row counter and this line is in a "for loop"
end with
After writing to excel, most of the cells in excel are correct. But some of the cell's text comes as ####### however if I click on the cell, formula bar shows the correct result. I have tried giving single code before adding the text still that did not help.
Please help me in resolving this.
Thank you
There is not any issue with your code. You need to increase the width of the column or have to use word wrap. In excel if your value is not fully visible it shows it is "######".
If widening and wrapping text doesn't work and the format is set to text which allows display of only 255 characters, try changing the format to general.
This just indicates that the cell is too small for showing the result: make it wider.
See https://superuser.com/questions/65556/excel-displays-for-long-text-whats-wrong for some common reasons why Excel displays "######" in cells.
Either the cell is too narrow to display the contents or the contents are over 256 characters.
Check what you're writing to the cell. If it's not too long then all you need to do is resize the column to fit the new contents.
This is simply what Excel does when the data in a column is too wide to be displayed in the current column width. Make the column slightly wider and you will see all your data.
To autosize the column so it is wide enough to display all its data, double click the column divider at the right edge of the column, in the header bar.

Take Textbox input and move to a specific cell.

I'm writing a macro to pull various data from an Excel sheet and put it in a more usable order. A problem I've run into is that one section of the data I want is contained in a textbox. I'd like to pull the data out of the textbox and have it all pasted into a cell, A100.
The textbox is always called ActivityA.
try this
Cells(100, 1) = ActiveSheet.Shapes("NameOfYourTextBox").DrawingObject.Text