How Could I run a macro multiple times in Mobaxterm? - automation

I'm trying to do macro multiple times in Mobaxterm.
I can make and use macro in Mobaxterm using Macro recording.
But I don't know How could I do it multiple times like,
macro 1st times ------> output1
macro 2nd times ------> output2
macro 3nd times ------> output3
.....
macro Nnd times ------> outputN
How could I solve it?

Related

Copy relevant rows and paste to new worksheet

I have multiple sheets which I am looking to copy and paste the relevant cells from rows into a new worksheet. The defining factor is whether the rows are "Live" which is determined by whether today falls between the "start date" and "end date" columns. For all rows that are "live" certain cells on that row should then be copy pasted to the bottom of the list on the new worksheet. I would then repeat these steps for the other worksheets so that the new worksheet essentially contains a summary of all "live" lines from the other sheets.
I then ultimately need to create a button so I can re-run this at the end of each day.
Hoping you can help!
You've defined and explained what you want to do nicely. So the next step would be to start researching the actions you want the code to do:
Start with how to copy rows:
http://www.bluepecantraining.com/copying-moving-rows-columns-excel-vba/
Next is how to find the last used row in a worksheet:
https://powerspreadsheets.com/excel-vba-last-row/
Next is to apply your condition on what rows to copy:
Using VBA to check if a date is between two dates
Next is how to create a for loop that runs the code the desired number of times:
https://www.excel-easy.com/vba/loop.html (a tip is to use the LastRow that you defined via the second link i posted. eg: "For x = 1 To LastRow")
And lastly is how to assign a macro to a button or shape:
https://wellsr.com/vba/2017/excel/how-to-assign-a-macro-to-a-shape-in-excel/
Try to build a code with the help of these links. If you get stuck, come back and show us what you've created and where the problem is. I (aswell as and many others) would love to help you on from there.

Excel not recalculating if formula until it's forced to

I've got a macro which generates a list from a spreadsheet, filters out things we need and don't need and formats it at the end. For filtering out information I am using a simple if formula which is inputted by my macro:
MyRange4.Formula = "=IF(M2<H2+1,""yes"",""no"")"
MyRange4.AutoFill Destination:=Formula3
When you run the macro, it is slowing it down a bit because it has to calculate for over 2000 lines, but it looked fine to me for a while, until we realized some of the lines we should have on the list are not there. When looking into it, I have filtered on the line we wanted, and the if formula was showing "no" which is obviously why it's not got excluded, but after 2-3 second the sheet recalculated and it's changed to "yes". Is there anyway I could force this to happen before the macro filters on the "yes" ones only so I am sure it's all correct?
Could this do the trick for you:
'Above this line: First bit of your code untill calculating formula's
Worksheets("Sheet1").UsedRange.Columns("A:A").Calculate 'Change sheetname and column accordingly
If Not Application.CalculationState = xlDone Then
DoEvents
End If
'Below this line: Second bit of your code, filtering the data

VBA code, Error 1004

Apollogies, I know this has been posted hundreds of times but Ive looked at them and still cant solve this
So I have a workbook (first time using vba)
first sheet is a graph
second sheet is a sheet containing values of nodes and stress
Third sheet is a sheet containing values of nodes and stress
Etc up to 17th sheet
I have a graph plot of stress vs number in sheet 1, and it contains only data from sheet 2 "stress1" and sheet 3 "stress2"
trying to make code to add the values of stress3 to my graph in sheet 1
CODE
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(x).Name = "=""Stress3"""
ActiveChart.SeriesCollection(x).Values = ThisWorkbook.Sheets("Stress3").Range("B9:B782")
Everything but the last line works, throws an error 1004 which I assume is because I have to do something to allow access to other sheets?
I have also tried
ActiveChart.SeriesCollection(x).Values = "=Stressx!$B$9:$B$782"
as the last line, same error
SOLVED
I am an idiot for putting x=3 at the top of my code, getting it working then not paying attention and removing it
the issue is the (x)
when I removed x=3 the sheets try to grab values from sheet x
which it doesnt know what x is
fixed by readding x=3 or changing the (x) to a number

Vlookup across different sheets

I am trying to do a vlookup across several sheets within the same workbook:
=IF(ISNA(VLOOKUP(A2,Regulares!J:L,3,0),ISNA(VLOOKUP('Temp Activos'!G:I,3,0),ISNA(VLOOKUP(A2,'Temp JA'!G:I,3,0),VLOOKUP(A2,'Temp Fit'!G:I,3,0)))))
But I keep getting the error that I have too many arguments???
I would also like to make a macro to add this vlookup to a cell in one of my sheets (PS), and bring the formula down to the last row (fill handle) upon pressing a button, but first need to figure out why it wont work before plugging it into a code...
The ISNA() function just needs one parameter, so your parentheses are out of sync. If you are using Excel 2007 or later, you can more easily use the IFERROR() function which has two parameter, the second being the value to return in case of error, which would be the next VLOOKUP in your case.

Need to Update External References in an Excel Sheet while a Macro is Running

I have an excel macro that sets Cells to an external location.
Range(NamedReference) = "='http://webaddress/ExcelSheet.xlsx'!NamedReference
Other cells use that location to calculate new values.
"A1" = NamedReference + 1
The problem is that I need to read the new calculated values back into the macro to export data, but the external link has not yet been calculated to any value. It is a #NAME? until the macro is done running. Is there any way to force excel to get those values during the macro run time?
I have tried a variety of things including
Calculate
CalculateFull
Any help would be appreciated. My current solution is to just close the macro on error and have the user re run the macro, but it is really kludgey.
**Edit: Forgot equals sign in formula
You could try
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
See on MSDN