Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() Hello, How do I write a for loop over columns? e.g. For k= A to AA ... is not working... thx in advance -- kizzie ------------------------------------------------------------------------ kizzie's Profile: http://www.excelforum.com/member.php...o&userid=26092 View this thread: http://www.excelforum.com/showthread...hreadid=394203 |
#2
![]() |
|||
|
|||
![]()
for k = 1 to 27
or ... with activesheet for k = .range("a1").column to .range("aa1").column ====== If you're using .cells(), then it can accept either letters or numbers for the column: cells(1,3).value = "asdf" is just as ok as: cells(1,"C").value = "asdf" kizzie wrote: Hello, How do I write a for loop over columns? e.g. For k= A to AA ... is not working... thx in advance -- kizzie ------------------------------------------------------------------------ kizzie's Profile: http://www.excelforum.com/member.php...o&userid=26092 View this thread: http://www.excelforum.com/showthread...hreadid=394203 -- Dave Peterson |
#3
![]() |
|||
|
|||
![]() thx Cells(Nr).Value = Cells(Nr).Value + Cells(ActiveCell.Rows, ActiveCell.Columns + 2).Value Whats wrong with this code? I want to add the value the cell 2 columns right of the active cell, to the cell named "Nr" thx -- kizzie ------------------------------------------------------------------------ kizzie's Profile: http://www.excelforum.com/member.php...o&userid=26092 View this thread: http://www.excelforum.com/showthread...hreadid=394203 |
#4
![]() |
|||
|
|||
![]()
Nr is a range name?
cells("Nr").value _ = cells("Nr").value + cells(activecell.row,activecell.column+2).value or cells("Nr").value _ = cells("Nr").value + activecell.offset(0,2).value kizzie wrote: thx Cells(Nr).Value = Cells(Nr).Value + Cells(ActiveCell.Rows, ActiveCell.Columns + 2).Value Whats wrong with this code? I want to add the value the cell 2 columns right of the active cell, to the cell named "Nr" thx -- kizzie ------------------------------------------------------------------------ kizzie's Profile: http://www.excelforum.com/member.php...o&userid=26092 View this thread: http://www.excelforum.com/showthread...hreadid=394203 -- Dave Peterson |
#5
![]() |
|||
|
|||
![]()
Oops....if Nr is really a named cell, use this intead.
Range("Nr").value _ = range("Nr").value + cells(activecell.row,activecell.column+2).value or range("Nr").value _ = range("Nr").value + activecell.offset(0,2).value Dave Peterson wrote: Nr is a range name? cells("Nr").value _ = cells("Nr").value + cells(activecell.row,activecell.column+2).value or cells("Nr").value _ = cells("Nr").value + activecell.offset(0,2).value kizzie wrote: thx Cells(Nr).Value = Cells(Nr).Value + Cells(ActiveCell.Rows, ActiveCell.Columns + 2).Value Whats wrong with this code? I want to add the value the cell 2 columns right of the active cell, to the cell named "Nr" thx -- kizzie ------------------------------------------------------------------------ kizzie's Profile: http://www.excelforum.com/member.php...o&userid=26092 View this thread: http://www.excelforum.com/showthread...hreadid=394203 -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Columns | Excel Discussion (Misc queries) | |||
Arithmetical Mode of Criteria in Multiple Non-Adjacent columns | Excel Worksheet Functions | |||
Hidden Columns in Shared Workbooks | Excel Discussion (Misc queries) | |||
can't insert columns between columns | Excel Discussion (Misc queries) | |||
Removing Near-Duplicate Rows, Leaving Those w/Most Data in Specific Columns | Excel Discussion (Misc queries) |