User Profile
JMB17
Bronze Contributor
Joined 6 years ago
User Widgets
Recent Discussions
Re: Macro execute to loop all word doc files in a folder
hrh_dash I'm not sure what the purpose of wordDoc is since you already have a reference to the document with oDoc? GetObject accepts string argument(s), but you're passing it an object. Since error handling is set to 'resume next' you're not getting an error. If you want wordDoc to also reference the document (but is this really necessary - do you really need 2 references to the same object?), then Set wordDoc = oDoc5.2KViews1like0CommentsRe: Macro execute to loop all word doc files in a folder
hrh_dash As Hans already stated, we don't know what's in the other procedures being called that extract the information. Specifically, we can't see how those procedures reference the word document referenced by the variable "oDoc" (because oDoc is a local variable and it's not being passed as an argument to the other procedures, so it's unclear how those procedures are referencing the document). I'm assuming the word object variable itself is globally scoped - are the other procedures referencing the document by index number (documents(1))? If the first document is not closed (because the variable name "wordDoc" appears to be incorrect as Hans noted), then documents(1) would still be referencing the first document. Personally, I would pass the document as an argument to the other function(s) instead of assuming which document it should process by some other means such as index number. Macro1() Macro2 oDoc End Sub Macro2(byref localVariableName as object) debug.print localVariableName.Paragraphs.Count End Sub Also, you should consider adding Option Explicit to the top of your module, if you're not already using it. Then, the compiler will help catch variable name issues such as misspellings or if you accidentally used "wordDoc" when you meant "oDoc" (if worddoc is not module or global level).5.2KViews0likes5CommentsRe: VBA code for copying from sheets and append it in a new work sheet or another workbook.
Jyothi1984 Perhaps something like this? This code just copies the worksheets used ranges, but if you want to limit it to only A2:C8, then just change this piece: wksht.UsedRange.Copy to wksht.Range("A2:C8").Copy Sub test() Dim destWksht As Worksheet Dim wksht As Worksheet Set destWksht = Workbooks.Add(xlWBATWorksheet).Worksheets(1) For Each wksht In ThisWorkbook.Worksheets wksht.UsedRange.Copy destWksht.Cells(destWksht.Rows.Count, 1).End(xlUp).Offset(2, 1) Next wksht End Sub9.6KViews1like1CommentRe: Using Sumwith sumifs for multiple critiera
Karim_Sakhi I believe sumifs will group your criteria like this: (Utility AND Asia AND Baden) OR (Game AND Europe AND WenCal) But, are you actually trying to do this? (Utility OR Game) AND (Asia OR Europe) AND (Baden OR WenCal) Perhaps try: =LET(criteria1, BYROW(--(A2:A28=K2:L2), LAMBDA(rw, SUM(rw))), criteria2, BYROW(--(B2:B28=K3:L3), LAMBDA(rw, SUM(rw))), criteria3, BYROW(--(C2:C28=K4:L4), LAMBDA(rw, SUM(rw))), SUM(D2:D28*criteria1*criteria2*criteria3))735Views0likes0CommentsRe: Help me simplify countifs
cocolopez4 It looks like your countif formula should work, but look to Peter's post to make it better. If it's not working for you, then perhaps upload an example of your data (without sensitive information), your formula, what results you're getting, and what results you're expecting.1.6KViews0likes0CommentsRe: Cell not populating correctly based on formula
Mickalopagus An oversight on my part. It also needs to verify I15 is not N/A (the #value is likely because I15 is N/A and it's trying to add 182). Try this: =IF(J16="completed", "Done", IF(I16<>"", "Pending", IF(AND(I15<>"", ISNUMBER(I15)), I15+182, IF(I15="N/A", H$3+60, ""))))1.2KViews0likes1CommentRe: Help me simplify countifs
I believe you could shorten the formula to (assuming I'm correct that the countifs functions are all the same except for the first argument testing column F against P20, P21, ..., P27): =SUM(('RAW DATA'!$F:$F=transpose('BN SERVICES'!P$20:P$27)) * ('RAW DATA'!$L:$L=$W$3) * ('RAW DATA'!$AA:$AA=$AB3) * ('RAW DATA'!$C:$C='BN SERVICES'!$AC3) * ('RAW DATA'!$O:$O>'BN SERVICES'!$Q$3) * ('RAW DATA'!$O:$O<'BN SERVICES'!$Q$4)) But, to improve the calculation lag you really should try to avoid using entire column references (over 1 million cells per column that have to be calculated). Can the data be put into a table and use structured table references?1.7KViews0likes3CommentsRe: FILTER Function using a cell reference as a Boolean for the Include parameter
I don't understand why you're trying to do it indirectly by concatenating an array constant to pass to the filter function instead of just referencing the range directly in the filter function? The issue is that the concatenated array is not actually an array as far as Excel is concerned, it's just text that means nothing to the filter function. You might be able to use an old Excel 4 macro function in a lambda to convert it. In the name manager, define a new name (call it EVAL) and refers to =lambda(expression, evaluate(expression)) Then, try =Filter(range, eval(A1)) where A1 is the text array constant. But, if you have to share the file with other users, you might test on their machines as I think there may be some security settings that could block Excel 4 macros.5.6KViews1like0CommentsRe: Excel formula
Neda1978 If your cell is showing 00:00, then you need to change the format from a time format (hh:mm) to a number format. In Excel, the integer part of a number is days and the decimal is time. An hh:mm format will only display the decimal part, which is zero, so you need to change the format to see the integer.1.1KViews0likes0CommentsRe: Converting Formulas
If it has to be index/match, then you could also try: =INDEX($P$4:$R$12, MATCH(J3, $O$4:$O$12), IFNA(MATCH(B3, {"u","g"}, 0), 3)) The only caveat is that if is possible someone might insert a column in between columns P and R, then will it still return the desired result (because your column reference is based on position and your columns could get shifted over). If you want the return value to be unaffected by inserting columns, then you could try (note two commas before IFNA function): =INDEX(($P$4:$P$12, $Q$4:$Q$12, $R$4:$R$12), MATCH(J3, $O$4:$O$12), , IFNA(MATCH(B3, {"u","g"}, 0), 3))904Views0likes0CommentsRe: Cell not populating correctly based on formula
Mickalopagus Yes, it is testing I15 for "n/a" and then processing the true condition for that IF statement (which is to test H3 for blank and either return blank or H3+60). This is your logic for your outermost IF statement. The rest of the formula (after ELSE) is only applicable when I15 is not "n/a". =IF(I15="n/a", THEN IF(H3="","", H3+60), ELSE IF(J16="Completed", "DONE", IF(NOT(J16="completed"), IF(I16<>0, "PENDING", IF(I15="","",I15+182))))) It's hard to tell what someone is trying to do from a formula that does not work. Perhaps explain more what you're trying to do and someone can assist with how to write the formula. Also, you might include what version of Excel you're using.1.3KViews1like5Comments- 1.2KViews0likes0Comments
Recent Blog Articles
No content to show