enhance add ins excel,using VB

faizshafie

New Member
Joined
Mar 6, 2011
Messages
10
hi there
i need help
i have a project
maybe it need to use VB but i dont really know how to program it
basic ideas are:

i need to autamated the excel files. an add ins
in this add in it can trigger my data acquisition to stat my measurement.
but formerly,it just use manually.click when we need..it repeatative.
so when we can autamated it it save our energy to click..

recently i try to use macros recording then i want to see the VB cding..then when i run it again,it fail. my friend said that i dont declare the variable..
but i dont know what variable i need to declare.

i just need a start button to manage the start button in the excel add in sheet..

or in other words:
It sounds like you need a VBA based addin with a button that when pressed will invoke your software to capture the data you are after and then import it into Excel after the program finishes.

how i need to do that?
 
Hi Sir.
sincerely sir.i dont understand what is the coding mean. i only plug n play.

can you tell me,what would happened from that coding when it can run?
So that we can discudd it further.
i need your help sir.thx
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Sub Macro2()
'
' Macro2 Macro
' try2
'
'
Range("C15:D15").Select
IgnoreBlank = Range("C15")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "10"
Range("C19:D19").Select
IgnoreBlank = Range("C15")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!ArmTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C11:D11").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C24:D24").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C24")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Meter Scan,Sheet1,Sheet2,Sheet3"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C11:D11").Select
IgnoreBlank = Range("C24")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Meter Scan,Sheet1,Sheet2,Sheet3"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!DataLocationWorksheet0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "2"
Range("C13:D13").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C13")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Run Once,Run Continuously"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C11:D11").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "3"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "4"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "5"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "6"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "7"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "8"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "9"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("C19:D19").Select
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!TaskStatusCmds0_DisplayStyle", RefersToR1C1:="=1"
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveCell.FormulaR1C1 = "10"
Range("C11:D11").Select
IgnoreBlank = Range("C19")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="INF,{value}"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWorkbook.Worksheets("Meter Scan").Names.Add Name:= _
"'Meter Scan'!SampleTriggerCount0_DisplayStyle", RefersToR1C1:="=2"
IgnoreBlank = Range("C11")
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Record,Start,Trigger,Stop,Reset,Clear"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
ActiveWindow.SmallScroll Down:=18
End Sub



this is the full idea of what the coding should be..
can you try to understand and help to explain to cleverless me..
please.
or you should try make correction as before.
sincerely need your help
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top