Selecting non-blank cells in Excel with VBA -
I'm just beginning to dive in VBA and I've hit a little disturbance.
I have a sheet that contains rows of 50+ columns, 900+ data. I need to reformat those 10 columns and paste them into a new workbook.
How do I programmatically select each blank cell in a column of Book 1, run it through some functions, and leave the results in Book2?
The following VBA code should start with you. This will copy all the data into a new workbook in the original workbook, but 1 will be added for each value in it, and all the blank cells will be ignored.
Options Clear Public Sub-ExportDataTouw Newbuk () Dim rowIndex Integer Gray ColInndex as Category Integer in Range as Range Data Reduce this Book as Workbook New Workbook New book in the form dim as new line integer dim temp '// Set your data range Set here Datangeense = Sheet 1.Range ("A1: B100")' // Create a new workbook Data in Book1 Newbook = Excel through Worksbook Add '// loop set, one for column ColIndex = 1 for Detroense at a time. Columns Row New = 0 rowIndex = 1 with amount of dataRange.Rows the amount of data. Ignore Seals (Line Indand, Coal Index) '// Blank Cells .value & lt; & Gt; "" Then newRow = newRow + 1 temp = doSomethingWith (.value) newBook.ActiveSheet.Cells (newRow, colIndex) .value = temp end if the next line ends with index Next colInndex End sub
private function doSomethingWith (aValue) '// This is where you use // in the new workbook // // In this example, I just To do this one works with AVI = AVUL + 1 works =
Comments
Post a Comment