Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I'm having no problems with selecting and manipulating single cell with variables but don't understand how to convert this to working wit Range. For example, in a macro I''ll find a row with the text "Starts: in column A. Working on any single cell (or complete row) reference from that start point isn't a problem, but if I want to work with mor than one cell, I do it one cell at a time because I can't figure ou how to select more than one using a Range with variables. I currently use this to delete some cells (columns I to M) and the move columns A to I to columns J to R. cLastRow = Cells(Rows.Count, "A").End(xlUp).Row For r = cLastRow To 1 Step -1 If InStr(1, Cells(r, "A"), "Starts:") 0 Then Cells(r, "I").Select Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft Selection.Cut Destination:=Cells(r, "R") Cells(r, "H").Select Selection.Cut Destination:=Cells(r, "Q") Cells(r, "G").Select Selection.Cut Destination:=Cells(r, "P") Cells(r, "F").Select Selection.Cut Destination:=Cells(r, "O") Cells(r, "E").Select Selection.Cut Destination:=Cells(r, "N") Cells(r, "D").Select Selection.Cut Destination:=Cells(r, "M") Cells(r, "C").Select Selection.Cut Destination:=Cells(r, "L") Cells(r, "B").Select Selection.Cut Destination:=Cells(r, "K") Cells(r, "A").Select Selection.Cut Destination:=Cells(r, "J") End If Next r Very messy but it works. ![]() I then use a similar procedure later to move the same range back t column A (need to get them out of the way for some text to colum stuff). I know it can be simplified with a range, but how do I do it -- Mark ----------------------------------------------------------------------- Mark K's Profile: http://www.excelforum.com/member.php...fo&userid=1411 View this thread: http://www.excelforum.com/showthread.php?threadid=57382 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Now I'm Really Confused | New Users to Excel | |||
Confused about range names | Excel Discussion (Misc queries) | |||
confused by linking to Cells in Other Workbooks | Excel Discussion (Misc queries) | |||
Confused about formatting of contents and cells? | Excel Programming | |||
confused... | Excel Programming |