Method To Run Macro From Mac & PC
Jul 15, 2007
I am trying to invoke an excel VBA macro from excel from a button or in some
way directly by the user (that is by not having to invoke macro from excel menu)
that can be invoked from a Macintosh or PC version of excel. That is, it should
not used active X controls but in some other way that is best practice. Is there
any way to invoke a macro by button or menu item that is cross-platform?
View 4 Replies
ADVERTISEMENT
Dec 10, 2008
I'm trying to get the Find and FindNext methods to work. Column C contains serial numbers and there's a chance that a serial number might appear more than once in the column. What I'm trying to do is get Excel to find the first occurance of the serial number, find what row it's on and then see if this matches the variable 'CurRowNo' (defined earlier in the code). If it doesn't I want it to look at the other occurances of the serial number, find what row they're on and see again if it matches CurRowNo.
The variable 'EngCount is the number of occurances of the serial number (also worked out earlier in the code). I've got the code below, but I get the error 'Method Range of Object Global Failed' on the FindNext line. I have no idea what this error means or why it's happening.
View 3 Replies
View Related
Jul 5, 2006
I have a macro on a workbook that when I hit the button it asks for the date of a register sales journal that I want to import. Then it asks for the cash in drawer amount. Then it puts in all of the data into the sales spreadsheet. Now I want to use the on time method to bypass the button and the entry of the date, and even get rid of the cash in drawer. I want to make the macro run at 9:30 every night. I want it to use the date on the computer to tell it which date to find? Here is the code I'm using! button macro
' Button2_Click Macro
Sub Button2_Click()
ImportData
End Sub
Here is the main macro
Function FileExists(sFile As String) As Boolean
Dim iLen As Integer
On Error Goto NO_FILE
FileExists = True
iLen = FileLen(sFile) ................
View 9 Replies
View Related
Aug 5, 2007
I have 2 macros, each called by the other to keep updates fast as per below,
Sub Macro1()
Cells.Replace What:=",29", Replacement:=",30", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Application .OnTime Now() + TimeValue("00:00:01"), "Macro2"
End Sub
Sub Macro2()
Cells.Replace What:=",30", Replacement:=",29", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Application.OnTime Now() + TimeValue("00:00:01"), "Macro1"
End Sub
I need to create a separate macro I can run to permanently stop these two cycling. And allow me to use Excel. Then, when I wish for these to cycle again, I simply run that macro.
View 4 Replies
View Related
Apr 18, 2006
The example Spreadsheet shows the current method of Ascending or Descending
Data according to Macro. Is there a way to replace the current Ascending or Descending macro code with a formula for the required cell groups only?
View 2 Replies
View Related
Sep 8, 2006
I use the following to try to access a secure website ( https )
ActiveWorkbook.FollowHyperlink Address:=Hyperlink, NewWindow:=False
Where hyperlink is a string that is valid. ( i tested by doing a cut and paste to the browser and it works ! ) When i launch the macro, it always bring me to the login screen. But if i do a cut and paste, it will bring me direct to the content i want.
View 6 Replies
View Related
Sep 30, 2006
I am working on a file which is a log of all the requests we send out to our vendors. We regularly need to re-send these requests to remind them they haven't responded yet, so I am working on a macro which takes the info from the log and re-populates the request form so everything doesn't have to be re-typed every time. I've added a MsgBox as a double-check to force people to confirm they want to re-send the request.
My problem is that if you hit "No" on the MsgBox, then try to run the code again, it gives me a Run-time Error 1004 saying "Paste method of Worksheet class failed". Can someone look at my code and see if you can tell me why it works the first time but not the second?
Sub RegenerateRequest()
If ActiveCell.Column = 1 And ActiveCell.Row > 7 Then
Application.Run "LogUnprotect"
ActiveCell.EntireRow.Copy
Sheets("Regenerate Request").Activate
Application.Run "RegenFormUnprotect"
Range("A40").Select
ActiveSheet.Paste 'this is the line the debugger highlights.............
View 3 Replies
View Related
Dec 16, 2006
I am facing problems with finding next instance of text using FindNext method. Kindly find code belowe which i have used.
Set srcCell = SourceBook.Worksheets(1).Columns("A").Find("Risk", After:= Sheets("SubArea"). Range("A21"), LookIn:=xlValues, lookat:=xlWhole)
'Set srcCell = SourceBook.Worksheets(1).Columns("A").FindNext
Set firstsrccell = srcCell
Do While Not (srcCell Is Nothing)
tgtCell.Offset(tgtRow, 0) = srcCell.Offset(-1, 255)
tgtCell.Offset(tgtRow, 1) = subAreaId
tgtCell.Offset(tgtRow, 2) = srcCell.Offset(0, 1)
tgtCell.Offset(tgtRow, 3) = srcCell.Offset(1, 1)
tgtCell.Offset(tgtRow, 5) = srcCell.Offset(3, 1)
tgtCell.Offset(tgtRow, 6) = srcCell.Offset(2, 1)
Set srcCell2 = SourceBook.Worksheets(1).Columns("A").FindNext
' If firstsrccell.Address = srcCell.Address Then
' Exit Do
' End If
tgtRow = tgtRow + 1
Loop
I checked above code by putting breakpoint, but code is unable to find next instance where it matches the required string (FindNext reamains at the same position).
View 9 Replies
View Related
Oct 11, 2012
I have used the macro recorder to generate the select range and clear part of the following macro.
Private Sub CommandButton2_Click()
Dim test As Worksheet
Sheets("Industry").Copy After:=Sheets(Sheets.Count)
[Code]....
I get the runtime error 1004 - Select method of range class failed.
I have used similar script in other macros without error.
View 2 Replies
View Related
Oct 28, 2008
My workbook holds a month template and sheets for each month. I work on modifications in the template ,but would then like to update all the monthly worksheets. I recorded a macro to show me how to start programming the vb sub, but get a runtime failure 'error 1004 Select method of range class failed' when trying to select the column to copy,
View 4 Replies
View Related
Dec 19, 2009
I have a macro that works by pasting formulas into cells and then pasting over them with the values produced by the formulas. It works fine for 500 iterations then crashes at this line:
View 8 Replies
View Related
Dec 14, 2008
Below is the code in which the macro is showing error
Run time error '1004'
Application-defined (or) Object defined error
View 8 Replies
View Related
Dec 14, 2008
giving me a macro to find a word in a sentence by using the "FIND" method.
For example I have a sentence say "I am happy" in which I have to search whether any of 2 words say "Happy" or "Sad" is there or not. If the sentence contains any of these words, then that row has to be highlighted.
View 9 Replies
View Related
Oct 3, 2007
with opening a workbook at a specific time and/or running a macro at a specific time.
View 12 Replies
View Related
Oct 17, 2008
I realy don't understand the FileExists method at all. My VBA Editor doesn't seem to recognise the keyword FileExists ?
Allot of examples will write FileExists(Dir(sFilePath)) in their explanation but I don't know what the Dir is referring to. Does this mean the directions to the file or is this referring to the directory and Dir is actually a keyword for direcory?
I don't think I've found a single simple example which explains this properly?
View 9 Replies
View Related
Oct 25, 2008
I have some code which renames files. The key line being
View 2 Replies
View Related
Jul 13, 2009
Is there a way to use the find method on 1 row only?
View 2 Replies
View Related
Jul 7, 2006
I'm having some trouble fully understanding the Intersect Method. The help files use examples that check if a range Intersects another, if the do then display a message box; I think I understand that.
The usage I don't understand is like this
Set MyRange = Range("C:C", "D:D", "E:E")
Code here
Intersect(CopyRange, MyRange).copy
View 4 Replies
View Related
Sep 21, 2006
I am trying to copy some code from the Excel help directory but I am getting an error saying "Compile Error, Can't find project or library".
What am I missing here?
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
End If
View 9 Replies
View Related
Jan 13, 2007
What's the easiest way to return the address of a cell without the dollar signs?
Example:
msgbox activecell.Address
' Returns $D$8
I'd like to see the address written as "D8" because I will be autofilling later.
View 2 Replies
View Related
Mar 20, 2009
I havent work with excel for years and now I have to do this as soon as possible:
There is a Donto's formula for calculating votes.
View 10 Replies
View Related
Sep 23, 2009
I have a conditional formatting or some other method (open to suggestions) which will identify those line items which need his attention.
I'm attaching a spreadsheet. Note that my items which I'd like flagged are not necessarily one right after the other in the column - i.e. there will be some which are skipped and not needed to be 'rated'.
View 8 Replies
View Related
Jul 28, 2008
I have a range object representing a data set, and I want to return only the first row of data from the range. The range starts at cell A2:
21 22 23 24 25
31 32 33 34 35
41 42 43 44 45
I.e. the value 21 is the data in cell A2 (row 2, column 1) and so forth.
'Given that WS1 is a worksheet object representing Sheet 1
'Given that WS2 is a worksheet object representing Sheet 2
View 12 Replies
View Related
Nov 13, 2008
I am running a vba code to add about 200 sheets...my code generates a sheet in one file and then pastes it in another file....after generating nad adding 38 sheets i get the error copy method of excel failed
i tried clearing the clipboard and resuming the code but that didn,t work
View 9 Replies
View Related
May 5, 2009
I am trying to sum the cells in a column from a variable starting row to a variable ending row. My problem is that I can not figure out how to use the "Range" method with variable values.
Below is what my code would look like if I was summing from I2 to I6 (hard coded)
View 3 Replies
View Related
Jun 26, 2009
I have a working macro that duplicates the active worksheet with values only. It basically cleans out formulas and data validation from the data. The code is:
View 2 Replies
View Related
Dec 23, 2009
I need a macro to run at a certain time on Wednesday's, and then a certain time on the other days.
I would like to use a cell to reference that time, but right now, I am just hard coding it, but I an not get it to run.
Ultimately what I am looking for is something like this: ....
View 12 Replies
View Related
Dec 21, 2011
I am going through a large block of data with formulas, where I am selecting each cell and manually highlighting the formula and pressing F4 to sorround the cell letter calls with $, example $A$11. I am doing this so I can ultimatley copy the formulas as a group into another group of cells with screwing them up. This is very time consuming so I am looking for an improved method, possibly using vb code?
View 9 Replies
View Related
May 8, 2012
I need to apply filters based on 2 criteria
Filter1Dropdown SelectionFilter2Dropdown SelectionHeader1Header2Header3Header4Header5Header6
Depending on what is selected in Filter 1, lets say it applies to column F and i get a data set
Now with the filtered dataset of Filter 1, I should be able to apply Filter 2 or vice versa.
Also at the end, I need to release all filters so that i can see the entire data set.
View 2 Replies
View Related
Aug 27, 2007
I know I must be missing something basic, but why is this code assigning a value to "NamePosition", instead of a range:
RightName = Sheets("WorkingSheet").Cells(1, 1).Value
Sheets("Tracker").Activate
Set StudentTbl = Sheets("Tracker").Range("A1:" & "Z" & NumStudents)
Set NamePosition = StudentTbl.Find(What:=RightName, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
I thought the find method returned a range?
View 6 Replies
View Related