How do you dynamically select data in excel?
-
I am trying to select data from a spreadsheet in excel, but I am trying to do so using a macro. I want to select all the data in a sheet (except the empty cells, and I want to be able to change the size of the matrix and have the macro perform the same function. How would I do this?
-
Answer:
Your question is a little contradicting in the sense that you state you wish to 'dynamically select data in Excel', yet you also say that you 'want to select ALL the data in a sheet, except empty cells'. If you wish to select a group of cells (matrix) and act upon those cells, here is an example of how to do that. The following macro will return the addresses of all cells in the 'matrix' selected that contain data. You can select non-contiguous and/or contiguous cells. Copy the following macro to the clipboard. Sub CellIDs() For Each cell In Selection If cell.Value <> "" Then cellVar = cellVar & cell.Address(0, 0) & ", " End If Next cellVar = Left(cellVar, Len(cellVar) - 2) MsgBox cellVar, vbOKOnly, "Matrix Cells" End Sub Access the VBE (ALT + F11) INSERT > MODULE Paste the macro into the editing area to the right. Close the VBE. Press ALT + F8 When the Macros window opens, highlight the macro and click 'Options...' Enter a letter to be used as a keyboard shortcut and click 'OK'. Close the Macros window. Highlight a group of cells, contiguous or non-contiguous, and press Ctrl + your shortcut letter. The cell address for all cells in your 'matrix', containing data, will be displayed in a message box.
question... at Yahoo! Answers Visit the source
Related Q & A:
- How to convert Json to CSV or Excel?Best solution by Stack Overflow
- How can I dynamically change the height of an iFrame?Best solution by Stack Overflow
- How do I randomly select a string from an array in swift?Best solution by Stack Overflow
- How to automatically delete certain rows in Excel?Best solution by Super User
- How to insert or select random ID's to CC or BCC, in the New Yahoo mail version?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.