Copying non-blank cells from one worksheet to another

schatham

New Member
Joined
May 28, 2003
Messages
42
Here is a sample of the data I am using.


Excel 2010
ABCD
1Myfolder5800
2Bin1800
3de40000
4en50000
5Random15043
6Random25044
Sheet1


I am importing it from a text file that is pipe delimited. The data represents a folder structure. Items in the same column are on the same level, those that are 1+ columns offset are subfolders of the folder one level to the left, and so on. There are a variable number of both rows and columns, but both would be less than the limits of Excel.

Unless there is some shorter way to do this, I believe that a macro would be the best way to do what I want to do.

My workbook has a sheet in it named "RawData". When a new file is created, I would import it into this worksheet (after clearing the previous contents). The imported data would always go in $A$1, with no header row. Once that is done, I'd like to go to another worksheet in this book named "FolderInfo" and clear any previous contents in it except for formulas in Columns A & B. Then, I would want to copy everything in the "RawData" worksheet into the "FolderInfo" sheet beginning in cell FolderInfo:$C$2 maintaining the relative offset of those columns in the "FolderInfo" sheet.

Once the data is copied/replicated into the new sheet, it would look like this:

Excel 2010
ABCDEFG
1F1 ColF2 ColCol CCol DCol ECol FCol .
2Formula1Formula2Myfolder5800
3Formula1Formula2Bin1800
4Formula1Formula2de40000
5Formula1Formula2en50000
6Formula1Formula2Random15043
7Formula1Formula2Random25044
Sheet1 (6)


Worksheet RawData will always have a variable number of rows & columns, and blanks will be in the data, but acceptable/necessary blank cells will always be to the left of occupied cells. To the best of my knowledge, the data should be in pairs that would be in cells adjacent to one another in the same row.

The data represents folder name & size, and the number of columns over indicates which folder it is a subfolder of.

I have another post in the forum describing this data structure where I was attempting to roll up subfolder totals & be able to drill down several levels (not yet figured out). This is where I am working on Plan B - another alternative to that.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,215,216
Messages
6,123,669
Members
449,114
Latest member
aides

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top