Есть макрос, требуется что бы, С поменялось на D. Не работает. Формула вида =Лист1!С5 [vba]
Код
Sub AVTOZAM_() Dim c As Range Dim s As String For Each c In UsedRange.Cells.SpecialCells(xlCellTypeFormulas) s = c.Formula If Mid(s, Len(s) - 2, 1) = "C" Then Mid(s, Len(s) - 2, 1) = "E": c.Formula = s Next End Sub
[/vba]
Есть макрос, требуется что бы, С поменялось на D. Не работает. Формула вида =Лист1!С5 [vba]
Код
Sub AVTOZAM_() Dim c As Range Dim s As String For Each c In UsedRange.Cells.SpecialCells(xlCellTypeFormulas) s = c.Formula If Mid(s, Len(s) - 2, 1) = "C" Then Mid(s, Len(s) - 2, 1) = "E": c.Formula = s Next End Sub
Sub AVTOZAM_() Dim c As Range For Each c In ActiveSheet.UsedRange.Cells.SpecialCells(xlCellTypeFormulas) c.Formula = Replace(c.Formula, "C", "D") Next End Sub
[/vba]
как-то так видимо: [vba]
Код
Sub AVTOZAM_() Dim c As Range For Each c In ActiveSheet.UsedRange.Cells.SpecialCells(xlCellTypeFormulas) c.Formula = Replace(c.Formula, "C", "D") Next End Sub
Sub AVTOZAM_() Dim c As Range For Each c In UsedRange.Cells.SpecialCells(xlCellTypeFormulas) c.Formula = Replace(c.Formula, "!C", "!E") c.Formula = Replace(c.Formula, "=C", "=E") Next End Sub
[/vba] Или так еще [vba]
Код
Sub AVTOZAM1_() UsedRange.Cells.SpecialCells(xlCellTypeFormulas).Replace What:="c", Replacement:="e" End Sub
[/vba] Не, наверно лучше все-таки предусмотреть название листа с латинским "С" [vba]
Код
Sub AVTOZAM1_() UsedRange.Cells.SpecialCells(xlCellTypeFormulas).Replace What:="!c", Replacement:="!e" UsedRange.Cells.SpecialCells(xlCellTypeFormulas).Replace What:="=c", Replacement:="=e" End Sub
[/vba]
Почти также [vba]
Код
Sub AVTOZAM_() Dim c As Range For Each c In UsedRange.Cells.SpecialCells(xlCellTypeFormulas) c.Formula = Replace(c.Formula, "!C", "!E") c.Formula = Replace(c.Formula, "=C", "=E") Next End Sub
[/vba] Или так еще [vba]
Код
Sub AVTOZAM1_() UsedRange.Cells.SpecialCells(xlCellTypeFormulas).Replace What:="c", Replacement:="e" End Sub
[/vba] Не, наверно лучше все-таки предусмотреть название листа с латинским "С" [vba]
Код
Sub AVTOZAM1_() UsedRange.Cells.SpecialCells(xlCellTypeFormulas).Replace What:="!c", Replacement:="!e" UsedRange.Cells.SpecialCells(xlCellTypeFormulas).Replace What:="=c", Replacement:="=e" End Sub