[AccessD] (OT) Excel Question

Heenan, Lambert Lambert.Heenan at AIG.com
Wed Aug 11 16:08:05 CDT 2004


You can also use row,column numbering to address a range. Like this

Dim oRng as Excel.Range
Dim xlSheet As Excel.Worksheet
DIm nFirstColumn as Long,  nLastColumn as Long
...
' some object initialization code snipped
...
Set oRng = xlSheet.Range(xlSheet.Cells(1, nFirstColumn), xlSheet.Cells(1,
nLastColumn))

Lambert

> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of
> Oleg_123 at xuppa.com
> Sent:	Tuesday, August 10, 2004 10:43 PM
> To:	accessd at databaseadvisors.com
> Subject:	[AccessD] (OT) Excel Question
> 
> Hello Group
> Does anyone know how I can loop across columns from column C till the last
> one ? I only know how to loop though numerics
> 
> Oleg
> 
> 
> Sub Numbers()
> Dim a As Integer
> Dim b As Integer
> Dim c
> 
> a = 7
> 
> Do While IsEmpty(Range("A" & a)) = False
> b = 0
> 
> If Range("C" & a) <> 0 Then b = b + 1
> If Range("D" & a) <> 0 Then b = b + 1
> If Range("E" & a) <> 0 Then b = b + 1
> If Range("F" & a) <> 0 Then b = b + 1
> If Range("G" & a) <> 0 Then b = b + 1
> If Range("H" & a) <> 0 Then b = b + 1
> If Range("I" & a) <> 0 Then b = b + 1
> If Range("J" & a) <> 0 Then b = b + 1
> If Range("K" & a) <> 0 Then b = b + 1
> If Range("L" & a) <> 0 Then b = b + 1
> If Range("M" & a) <> 0 Then b = b + 1
> If Range("N" & a) <> 0 Then b = b + 1
> If Range("O" & a) <> 0 Then b = b + 1
> 
> If b >= 2 Then Range("A" & a).Font.ColorIndex = 3
> a = a + 1
> 
> Loop
> 
> End Sub
> 
> 
> -----------------------------------------
> Make Money and Find Love at Finally.com
> http://www.finally.com/?link=webmail
> 
> 
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list