Форум программистов, компьютерный форум, киберфорум
MS Office Excel
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
0 / 0 / 0
Регистрация: 16.02.2019
Сообщений: 4
1

Как упростить код VBA&

03.12.2019, 02:41. Показов 598. Ответов 0

Author24 — интернет-сервис помощи студентам
Как сократить код? Как записать повторяющийся 3 раза одинаковый кусок кода????

ActiveSheet.ChartObjects.Add(50, 50, 288, 216).Select
ActiveChart.ChartWizard Source:=Range(Worksheets(2).Cells(1, 1), Worksheets(2).Cells(A, 2)), Gallery:=xlLineMarkers, Format:=2, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=0, HasLegend:=False, Title:="????? ??????? ??? ????? v(x)" '??????? ??????? ? ????? ??????????
ActiveChart.Axes(xlCategory).HasTitle = True
ActiveChart.Axes(xlCategory).AxisTitle.Characters.Text = "x, ?"
ActiveChart.Axes(xlValue).HasTitle = True
ActiveChart.Axes(xlValue).AxisTitle.Characters.Text = "v, ?"
ActiveChart.Axes(xlValue).Select
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
Selection.Format.Line.EndArrowheadStyle = msoArrowheadStealth
With Selection.Format.Line
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadWidth = msoArrowheadWide
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
End With
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
Selection.Format.Line.EndArrowheadStyle = msoArrowheadStealth
With Selection.Format.Line
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadWidth = msoArrowheadWide
End With
ActiveChart.Axes(xlCategory).HasMajorGridlines = True
ActiveChart.Export Filename:="chart1.gif", FilterName:="gif"
UserForm1.img1.Picture = LoadPicture("chart1.gif")

ActiveSheet.ChartObjects.Add(50, 50, 288, 216).Select
ActiveChart.ChartWizard Source:=Range(Worksheets(2).Cells(1, 3), Worksheets(2).Cells(A, 4)), Gallery:=xlLineMarkers, Format:=2, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=0, HasLegend:=False, Title:="????? ???? ???????? ??? ????? v1(x)" '??????? ??????? ? ????? ??????????
ActiveChart.Axes(xlCategory).HasTitle = True
ActiveChart.Axes(xlCategory).AxisTitle.Characters.Text = "x, ?"
ActiveChart.Axes(xlValue).HasTitle = True
ActiveChart.Axes(xlValue).AxisTitle.Characters.Text = "v1, ???"
ActiveChart.Axes(xlValue).Select
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
Selection.Format.Line.EndArrowheadStyle = msoArrowheadStealth
With Selection.Format.Line
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadWidth = msoArrowheadWide
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
End With
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
Selection.Format.Line.EndArrowheadStyle = msoArrowheadStealth
With Selection.Format.Line
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadWidth = msoArrowheadWide
End With
ActiveChart.Axes(xlCategory).HasMajorGridlines = True
ActiveChart.Export Filename:="chart2.gif", FilterName:="gif"
UserForm1.img2.Picture = LoadPicture("chart2.gif")

ActiveSheet.ChartObjects.Add(50, 50, 288, 216).Select
ActiveChart.ChartWizard Source:=Range(Worksheets(2).Cells(1, 5), Worksheets(2).Cells(A, 6)), Gallery:=xlLineMarkers, Format:=2, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=0, HasLegend:=False, Title:="????? ??????????? ??????? M0(x)" '??????? ??????? ? ????? ??????????
ActiveChart.Axes(xlCategory).HasTitle = True
ActiveChart.Axes(xlCategory).AxisTitle.Characters.Text = "x, ?"
ActiveChart.Axes(xlValue).HasTitle = True
ActiveChart.Axes(xlValue).AxisTitle.Characters.Text = "M0, ??*?"
ActiveChart.Axes(xlValue).Select
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
Selection.Format.Line.EndArrowheadStyle = msoArrowheadStealth
With Selection.Format.Line
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadWidth = msoArrowheadWide
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
End With
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
Selection.Format.Line.EndArrowheadStyle = msoArrowheadStealth
With Selection.Format.Line
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadWidth = msoArrowheadWide
End With
ActiveChart.Axes(xlCategory).HasMajorGridlines = True
ActiveChart.Export Filename:="chart3.gif", FilterName:="gif"
UserForm1.img3.Picture = LoadPicture("chart3.gif")
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
03.12.2019, 02:41
Ответы с готовыми решениями:

Нужен драйвера, код PCI\VEN_1039&DEV_7012&SUBSYS_0C98105B&REV_A0\3&B1BFB68&0&17
всем привет !! уменя нет звука нужен драйвер код...

Код VBA можно упростить или нет?
Уважаемые господа! Подскажите пожалуйста можно ли упростить вот этот код VBA. Если да то как? ...

Wpf не виставляются нормально координати елипса && как преобразовать код xaml в код C#
собственно вот код программы using System; using System.Collections.Generic; using System.Linq;...

Как изменить код чтоб в xml файл записывалось не с &gt; &lt; а с <>?
Нужно так: &lt;contents&gt; &lt;attribute name=&quot;Name&quot;&gt; &lt;value&gt;&lt;string...

0
03.12.2019, 02:41
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
03.12.2019, 02:41
Помогаю со студенческими работами здесь

Как упростить выражение с ComboBox Vba?
Здравствуйте, товарищи! Есть код по ComboBox'ам на форме: Private Sub Combobox1_Change() If...

query='SELECT * FROM resume WHERE ' & ''' & RecSet('place')& ''' & '=' & '''& s_loc &''' & - что не так?
упростил для краткости запрос. в чем ошибка? RecSet - это коннекшн. query='SELECT * FROM resume...

как упростить код
подскажите пожалуйста как можно уменьшить объём кода If TextBox3.Text = avto(0) Then ...

Как упростить код?
Нужен совет. Есть процедура в которой для полей модели проверяется дата и записуется обратно. По...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru