Excel赢得';t插入列
我的工作簿不允许我插入新列。这是一个启用宏的工作簿,我认为这是问题的原因。当我插入一个新列时,除了页面上的activeX按钮向右移动外,什么也不会发生。我怎样才能解决这个问题 这是正在发生的事情的gif。请注意,在右上角,按钮随着每次插入向右移动 宏是一个循环,它对数据范围从最高到最低的周转率进行排序,并添加一个可自由分配的单元,直到没有可分配的单元为止。简化代码段:Excel赢得';t插入列,excel,vba,Excel,Vba,我的工作簿不允许我插入新列。这是一个启用宏的工作簿,我认为这是问题的原因。当我插入一个新列时,除了页面上的activeX按钮向右移动外,什么也不会发生。我怎样才能解决这个问题 这是正在发生的事情的gif。请注意,在右上角,按钮随着每次插入向右移动 宏是一个循环,它对数据范围从最高到最低的周转率进行排序,并添加一个可自由分配的单元,直到没有可分配的单元为止。简化代码段: Sub SecondaryDistrLoop() Application.ScreenUpdating = False
Sub SecondaryDistrLoop()
Application.ScreenUpdating = False
'Set variables
'Calculate the worksheet to ensure all formulas are up to date
ActiveSheet.Calculate
'get secondary allocation amount to distribute
AmountToDistribute = Range("Q2")
'get address of title cell where secondary allocaton goes (TITLED: Natl Reserve Discretionary)
Cells.Find(What:="Natl Reserve Discretionary", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Set AllocationAdjustmentTitleCell = Range(ActiveCell, ActiveCell)
'get address of Dec Turn Rate column to sort on
Cells.Find(What:="Dec Turn Rate", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
'get address of title cell for sorting column TITLE: (New DS on 3 Mth Avg Sales)
SortColumnAddressString = ActiveCell.Address(Rowabsolute:=False, columnabsolute:=False)
SortColumnReferenceString = Left(SortColumnAddressString, 1)
ChartTitleRowNumber = Right(SortColumnAddressString, 1)
'Find Range of dealers to be sorted - aka finding range until the national summary rows
Cells.Find(What:="Code", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True _
, SearchFormat:=False).Activate
LastRow = ActiveCell.End(xlDown).Row - 1
LastColumn = ActiveCell.End(xlToRight).Column + 17
Set DataRange = Range(Cells(ActiveCell.Row + 1, ActiveCell.Column), Cells(LastRow, LastColumn))
AllocationAdjustmentTitleCell.Activate
'start loop
Do Until AmountToDistribute = 0
'update formulas
ActiveSheet.Calculate
'Sort data to bring highest days supply to the top of list - range is built of dynamically finding column name New DS on 3 mth avg sales
DataRange.Sort key1:=Range(SortColumnReferenceString & ChartTitleRowNumber + 1 & ":" & SortColumnReferenceString & LastRow), _
order1:=xlDescending, Header:=xlNo
'set lowest days supply to increase secondary allocation by 1
AllocationAdjustmentTitleCell.Offset(1, 0) = AllocationAdjustmentTitleCell.Offset(1, 0).Value + 1
'reduce the amount to distribute by 1
AmountToDistribute = AmountToDistribute - 1
Loop
Application.ScreenUpdating = True
End Sub
问题在于如何从网络位置处理该文件。我把文件放在本地驱动器上,它被修复了……头晕目眩、不知所措从网络位置处理文件是个问题。我把文件放在本地硬盘上,所有的问题都解决了……头晕目眩,不知所措我想你的文章没有列出来。Excel 2010允许使用16384。该列左侧是否有隐藏列。它可能是在插入隐藏列吗?@MatthewD Nope…..只使用最多T列。。。。。整个工作簿都是这样运行的。没有要取消隐藏的列。我可以一直单击insert column,只需在代码中继续向右推按钮,您是否正在执行类似Application.EnableEvents=False的操作?工作表是否受保护?你看过VBA代码了吗?工作表模块中有什么代码?你有没有试着去理解它或者以任何方式去修复它?请给我们一些帮助。@Jean-FrançoisCorbett请看我的代码片段。我只是在运行一个循环,在重新计算后对数据进行排序。我假设您的数据没有列。Excel 2010允许使用16384。该列左侧是否有隐藏列。它可能是在插入隐藏列吗?@MatthewD Nope…..只使用最多T列。。。。。整个工作簿都是这样运行的。没有要取消隐藏的列。我可以一直单击insert column,只需在代码中继续向右推按钮,您是否正在执行类似Application.EnableEvents=False的操作?工作表是否受保护?你看过VBA代码了吗?工作表模块中有什么代码?你有没有试着去理解它或者以任何方式去修复它?请给我们一些帮助。@Jean-FrançoisCorbett请看我的代码片段。我只是在运行一个循环,在重新计算后对数据进行排序。