Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Looping through columns

Hi, would like to do the following operation with columns C:H
and then columns K:M,

Im missing a couple of lines in my code below which will loop through
necessary cols, any help is much appreciated

sub()

Dim intNumRows As Integer, c As Variant, lngCellTotal As Long
Dim x As Integer

intNumRows = Cells(50, "c").End(xlUp).Row
With Range("c" & intNumRows + 1)
.Borders(xlEdgeTop).Weight = xlMedium

End With
For Each c In Range("c1", "c" & intNumRows)
lngCellTotal = lngCellTotal + c.Value
Next
Range("c" & intNumRows + 1) = lngCellTotal

end sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Looping through columns

See your previous post. You can adjust the code there to do what you want.

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Hi, would like to do the following operation with columns C:H
and then columns K:M,

Im missing a couple of lines in my code below which will loop through
necessary cols, any help is much appreciated

sub()

Dim intNumRows As Integer, c As Variant, lngCellTotal As Long
Dim x As Integer

intNumRows = Cells(50, "c").End(xlUp).Row
With Range("c" & intNumRows + 1)
.Borders(xlEdgeTop).Weight = xlMedium

End With
For Each c In Range("c1", "c" & intNumRows)
lngCellTotal = lngCellTotal + c.Value
Next
Range("c" & intNumRows + 1) = lngCellTotal

end sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Looping through columns

Where has this digressed from B to I?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
Hi, would like to do the following operation with columns C:H
and then columns K:M,

Im missing a couple of lines in my code below which will loop through
necessary cols, any help is much appreciated

sub()

Dim intNumRows As Integer, c As Variant, lngCellTotal As Long
Dim x As Integer

intNumRows = Cells(50, "c").End(xlUp).Row
With Range("c" & intNumRows + 1)
.Borders(xlEdgeTop).Weight = xlMedium

End With
For Each c In Range("c1", "c" & intNumRows)
lngCellTotal = lngCellTotal + c.Value
Next
Range("c" & intNumRows + 1) = lngCellTotal

end sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
looping through rows and columns mattguerilla Excel Discussion (Misc queries) 1 March 20th 07 05:14 PM
looping across columns in range? Amy Excel Discussion (Misc queries) 3 July 19th 05 08:01 PM
Looping thru columns beyond Z John Pierce Excel Programming 3 January 23rd 04 12:17 AM
Need Looping Help [email protected] Excel Programming 2 October 29th 03 08:11 PM
Looping question for 2 columns [email protected] Excel Programming 1 October 24th 03 02:33 PM


All times are GMT +1. The time now is 05:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"