unable to paste conditional formattting to another workbook - conditional-formatting

Excel 365 FR
Hello,
It seems impossible to paste conditional formatting to another workbook when there is a reference to another sheet, even if there is the same sheet in the the target workbook :
Source :
Target :
I'm stuck. It works when there is no reference to another worksheet.
Is there a workaround ?
Regards.

Related

VBA Copying a macro and a worksheet which has a button assigned to the macro to another worksheet

I have an xlsm file which has a macro and worksheets. I need to copy the macro and a worksheet to a different workbook. Like to know the easiest way to do. Thanks!
Right-Click on the Sheet's tab and create a copy of the sheet in a new workbook.

Reference an excel sheet from another workbook without copying the sheet

Im wondering if it's possible to reference an excel sheet from another work book without making a copy of that sheet?
The situation : I have some very large worksheets filled with various data, but i don't want to keep a copy of them open in my workbooks because while each workbook uses the same data source, they're slightly different.
I have a vba routine that takes this data and creates input files for other codes, vba expects this data to be available on the defined sheet names.
Is it possible to make either excel or vba to know that when i request worksheet("Example_1") it instead knows that i mean example_1 from a different workbook?
Thanks
Yes, it is possible.
You need to add those lines to your code:
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Set wkb = Excel.Workbooks("name_of_workbook.xlsx")
Set wks = wkb.Worksheets("Example_1")
Now, every time you want to refer to a range from this other workbook, you need to add wks. before, i.e.:
'Printing value in cell.
wks.Range("A1") = "x"
'Selecting range.
call wks.Range(wks.Cells(1,1), wks.Cells(2,2)).Select
=SUM('C:\test\[test.xlsx]sheet_name'!A1:A25)
is an example of a formula which references sheet sheet_name in workbook C:\test\text.xlsx.
Note that when the other workbook is opened, the formula automatically changes to
=SUM([test.xlsx]sheet_name!A1:A25)
and then when it is closed, the formula will change back.

Copy and paste entire sheet from different workbook

Does anyone help me with copying the WHOLE sheet instead of C3:D4?
wb.Worksheets(2).Range("C3:D4").Value = wb2.Worksheets(1).Range("A1:B2").Value
wb2.Worksheets(1).Cells.Copy wb.Worksheets(2).Range("A1")
Why not directly copy the first sheet into the second workbook :
wb2.Sheets(1).Copy Before:=wb.Sheets(2)

Vb.net Updating excel formula with references to other workbooks

I am trying to update some formulas from one workbook, to another workbook. Everything is working great until I run into a formula that has a reference to another workbook. For example a formula like this =IF(ISERROR(W!Var1),0,W!Var2) It will prompt me to open this workbook, I am assuming so that it can evaluate the formula. So my question is this. Is there a way for me to handle these situations on the fly, so if there is a workbook reference needed it will prompt me and then save it to memory? Because if I have more than one cell that contains these formulas it will prompt me to open the referenced workbook for every cell that contains the link. Alternatively, is there a way that I can just push my formula into the cell without having excel evaluate it?
So in my code I have this line which works for any value that doesn't contain a workbook reference. TheRange.RefersToRange.FormulaR1C1 = RangeFormula
Any help is greatly appreciated.
I understand that you refer to Worksheets (each of the "tabs" in a given Excel file), the Workbook is the whole file. The popping-up message appears when the referred Worksheet cannot be found. Example: range.Value = "=sheet5!A3" (in a Workbook having just "sheet1", "sheet2" and "sheet3"). If you want to avoid this message (although bear in mind that the Worksheet is not there and thus the calculations will be wrong anyway), you can write:
excelApp.DisplayAlerts = False
Where excelApp is the Excel.Application you are currently using.

Excel Copy Worksheet from external WorkBook

What I am doing is copying a sheet from a different workbook to my current workbook. I'm basically doing the following:
Delete the current Worksheet in the current Workbook
Open the external Workbook and Copy the Worksheet required
This all works as expected but all references in the other sheets are lost and replaced with #REF.
Is there a workaround (other than find and replace hack) that can be done to avoid this.
Regards,
Lloyd
You could try using Clear and Copy-Paste instead:
- Clear the contents of the current worksheet
- copy the external worksheet
- paste into the current sheet
Why don't you just copy the values contained in the sheet instead of the whole sheet object?
v = Workbooks("Book1").Worksheets("Sheet2").Range("A1:IV65536")
Workbooks("Book3").Worksheets("Sheet1").Range("A1:IV65536") = v
where v is a Variant. Or,
Workbooks("Book3").Worksheets("Sheet1").Range("A1:IV65536") = _
Workbooks("Book1").Worksheets("Sheet2").Range("A1:IV65536")
This takes a couple of seconds, but will be faster if you reduce the range to what you really need ("A1:IV65536" is presumably exaggerated...)
Of course this won't do if you also have formulas in the sheet you're copying and you need those formulas in the destination sheet. It isn't clear from your question what exactly you're trying to accomplish.