Skip to content

Instantly share code, notes, and snippets.

@aptavout
aptavout / iterate-workbooks.bas
Created May 24, 2013 03:23
Iterate across open workbooks in Excel VBA
For Each wb In Workbooks
wb.Activate
Debug.Print ActiveWorkbook.Name
wb.Close
Next
@aptavout
aptavout / iterate-by-rows.bas
Created May 24, 2013 03:26
Travel row-by-row of a workbook with Excel VBA.
Range("A1").Select
Range(ActiveCell, ActiveCell.CurrentRegion).Select
For Each row In Selection.Rows
Debug.Print Cells(row.Row, 1) ' value of first column in current row
Next
@aptavout
aptavout / iterate-2d.bas
Created May 24, 2013 03:30
Treat an Excel workbook as a 2-dimensional array, and iterate over it.
Range("A1").Select
Range(ActiveCell, ActiveCell.CurrentRegion).Select
For Each row In Selection.Rows
Dim rowStr As String
For Each col In Selection.Columns
rowStr = rowStr & Cells(row.Row, col.Column)
If col.Column < Selection.Columns.Count Then
rowStr = rowStr & ","
@echo off
setlocal
set winincludes=C:\Program Files\PellesC\Include\Win
set sysincludes=C:\Program Files\PellesC\Include
set INCLUDE=%winincludes%;%sysincludes%
rem /Ze: use Microsoft extensions to avoid winnt.h "No specific architecture" error
pocc sqlite.c /Ze