Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this code which errors on the resize line
Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The .resize(0,1) says to resize that single cell to a range of 0 rows by 1
column. That doesn't exist. Maybe you meant .resize(1,2) (one row by 2 columns???) I think I'd add just a bit of a check: Dim FoundCell As Range Set FoundCell = Cells.Find(what:="Pending", after:=ActiveCell, _ LookIn:=xlFormulas, lookat:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then MsgBox "not found" Else If FoundCell.Column = ActiveSheet.Columns.Count Then MsgBox "nothing to the right!" Else FoundCell.Resize(1, 2).EntireColumn.Cut FoundCell.Offset(0, 3).EntireColumn.Insert Shift:=xlToRight End If End If And I think you meant .offset(0,3) for the insertion, too. But test it to see if it does what you want. GregR wrote: I have this code which errors on the resize line Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave, I'm glad someone knows what I want. One more question, when I
record a macro after every recorded line, I get a line Application.run "Update" What is that and how do I stop it. TIA Greg Dave Peterson wrote: The .resize(0,1) says to resize that single cell to a range of 0 rows by 1 column. That doesn't exist. Maybe you meant .resize(1,2) (one row by 2 columns???) I think I'd add just a bit of a check: Dim FoundCell As Range Set FoundCell = Cells.Find(what:="Pending", after:=ActiveCell, _ LookIn:=xlFormulas, lookat:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then MsgBox "not found" Else If FoundCell.Column = ActiveSheet.Columns.Count Then MsgBox "nothing to the right!" Else FoundCell.Resize(1, 2).EntireColumn.Cut FoundCell.Offset(0, 3).EntireColumn.Insert Shift:=xlToRight End If End If And I think you meant .offset(0,3) for the insertion, too. But test it to see if it does what you want. GregR wrote: I have this code which errors on the resize line Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are you running a macro called Update (maybe by clicking a button or from a
toolbar)?? If you are, then stop recording before you click that button. GregR wrote: Dave, I'm glad someone knows what I want. One more question, when I record a macro after every recorded line, I get a line Application.run "Update" What is that and how do I stop it. TIA Greg Dave Peterson wrote: The .resize(0,1) says to resize that single cell to a range of 0 rows by 1 column. That doesn't exist. Maybe you meant .resize(1,2) (one row by 2 columns???) I think I'd add just a bit of a check: Dim FoundCell As Range Set FoundCell = Cells.Find(what:="Pending", after:=ActiveCell, _ LookIn:=xlFormulas, lookat:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then MsgBox "not found" Else If FoundCell.Column = ActiveSheet.Columns.Count Then MsgBox "nothing to the right!" Else FoundCell.Resize(1, 2).EntireColumn.Cut FoundCell.Offset(0, 3).EntireColumn.Insert Shift:=xlToRight End If End If And I think you meant .offset(0,3) for the insertion, too. But test it to see if it does what you want. GregR wrote: I have this code which errors on the resize line Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg -- Dave Peterson -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave, I do have a macro called Update, but I have not set it in motion
or clicked a button to activate it, not sure what is happening. Greg Dave Peterson wrote: Are you running a macro called Update (maybe by clicking a button or from a toolbar)?? If you are, then stop recording before you click that button. GregR wrote: Dave, I'm glad someone knows what I want. One more question, when I record a macro after every recorded line, I get a line Application.run "Update" What is that and how do I stop it. TIA Greg Dave Peterson wrote: The .resize(0,1) says to resize that single cell to a range of 0 rows by 1 column. That doesn't exist. Maybe you meant .resize(1,2) (one row by 2 columns???) I think I'd add just a bit of a check: Dim FoundCell As Range Set FoundCell = Cells.Find(what:="Pending", after:=ActiveCell, _ LookIn:=xlFormulas, lookat:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then MsgBox "not found" Else If FoundCell.Column = ActiveSheet.Columns.Count Then MsgBox "nothing to the right!" Else FoundCell.Resize(1, 2).EntireColumn.Cut FoundCell.Offset(0, 3).EntireColumn.Insert Shift:=xlToRight End If End If And I think you meant .offset(0,3) for the insertion, too. But test it to see if it does what you want. GregR wrote: I have this code which errors on the resize line Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave, another small problem, I have this formula that finds the
intersection of a row/col and returns a value. I want to move the value at this address one column to the right. It is part of this macro above. How do I do it or what is the VBA solution? The formula is: Index($A$1:$A$Z100,Match("Cap",A1:A100,0),match(da tevalue("5/1/2006"),A1:AZ1,0)). TIA Greg GregR wrote: Dave, I do have a macro called Update, but I have not set it in motion or clicked a button to activate it, not sure what is happening. Greg Dave Peterson wrote: Are you running a macro called Update (maybe by clicking a button or from a toolbar)?? If you are, then stop recording before you click that button. GregR wrote: Dave, I'm glad someone knows what I want. One more question, when I record a macro after every recorded line, I get a line Application.run "Update" What is that and how do I stop it. TIA Greg Dave Peterson wrote: The .resize(0,1) says to resize that single cell to a range of 0 rows by 1 column. That doesn't exist. Maybe you meant .resize(1,2) (one row by 2 columns???) I think I'd add just a bit of a check: Dim FoundCell As Range Set FoundCell = Cells.Find(what:="Pending", after:=ActiveCell, _ LookIn:=xlFormulas, lookat:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then MsgBox "not found" Else If FoundCell.Column = ActiveSheet.Columns.Count Then MsgBox "nothing to the right!" Else FoundCell.Resize(1, 2).EntireColumn.Cut FoundCell.Offset(0, 3).EntireColumn.Insert Shift:=xlToRight End If End If And I think you meant .offset(0,3) for the insertion, too. But test it to see if it does what you want. GregR wrote: I have this code which errors on the resize line Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it perhaps running in one of your worksheet/workbook events - for
instance Worksheet_SelectionChange or something similar? Jeff "GregR" wrote in message oups.com... Dave, I do have a macro called Update, but I have not set it in motion or clicked a button to activate it, not sure what is happening. Greg Dave Peterson wrote: Are you running a macro called Update (maybe by clicking a button or from a toolbar)?? If you are, then stop recording before you click that button. GregR wrote: Dave, I'm glad someone knows what I want. One more question, when I record a macro after every recorded line, I get a line Application.run "Update" What is that and how do I stop it. TIA Greg Dave Peterson wrote: The .resize(0,1) says to resize that single cell to a range of 0 rows by 1 column. That doesn't exist. Maybe you meant .resize(1,2) (one row by 2 columns???) I think I'd add just a bit of a check: Dim FoundCell As Range Set FoundCell = Cells.Find(what:="Pending", after:=ActiveCell, _ LookIn:=xlFormulas, lookat:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then MsgBox "not found" Else If FoundCell.Column = ActiveSheet.Columns.Count Then MsgBox "nothing to the right!" Else FoundCell.Resize(1, 2).EntireColumn.Cut FoundCell.Offset(0, 3).EntireColumn.Insert Shift:=xlToRight End If End If And I think you meant .offset(0,3) for the insertion, too. But test it to see if it does what you want. GregR wrote: I have this code which errors on the resize line Cells.Find(what:="Pending", after:=ActiveCell, LookIn:=xlFormulas, lookat:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Resize(0, 1).Select Selection.EntireColumn.Cut ActiveCell.Offset(0, 1).Select Selection.Insert Shift:=xlToRight What the desired result is, look for cell with "Pending", select that cell and the one to the right, cut both those columns and move them one to the right. TIA Greg -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
Problem transferring array data onto worksheet using Resize | Excel Programming | |||
having problem with resize | Excel Programming | |||
problem with resize property | Excel Programming | |||
Resize Range Problem | Excel Programming |