Skip to main content

Posts

Calling a macro from a macro that displays a chart.

Calling a macro from a macro that displays a chart. Once the chart is created, should the user click on the chart it will execute a macro. Sub TestAssignMacro() ' Reference ChartObject by Name ActiveSheet.ChartObjects("Chart 1").OnAction = _ "CopyChartWithRatio" ' ... or reference ChartObject by Index (it's the same) ActiveSheet.ChartObjects(1).OnAction = _ "CopyChartWithRatio" End Sub Sub CopyChartWithRatio() ' When you click Chart, this macro will run MsgBox "Hi from Chart" End Sub

Highlighti​ng Duplicates Based On Two Columns in Excel

When your requirements were simply to detect repeated occurrences of the value in Column C, I suggested using conditional formatting with the formula: =MATCH(C1,C:C,0)<>ROW(C1) Now you have extended the requirements to detect only those cases where the description (in Column D) is different. That simply means extending the formula to something like: =AND(MATCH(C1,C:C,0)<>ROW(C1),OFFSET($D $1,MATCH(C1,C:C,0)-1,0)<>D1) The point is that you can achieve the desired results entirely with nothing more than a conditional format.

Compare Values in the Same Column in sql

Need to locate customers who has placed their orders twice in a certain period. Now, the order might not be exactly the same, thus  cant use a normal query finding duplications, but rather compare the order values of a customer and indicate the orders whose values differ with about 20%.. the simplest would be select t1.customerid,t1.orderid,t1.ordervalue ,t2.ordervalue from Table1 as T1 join Table1 as T2 on t1.orderid <> t1.orderid and t1.customerid = t2.customerid and t1.ordervalue < t2.ordervalue * 1.2 and t1.ordervalue > t2.ordervalue * .8

Insert Names Across Rows Using Macro,Open Sheet is in the Home Position,Export Camera Picture,Convert Dates- excel Tips

Insert Names Across Rows Using Macro in excel  standard module Sub Test() Dim x As Worksheet Application.DisplayAlerts = False On Error Resume Next Sheets("DataSheet").Delete Names("Data").Delete Application.DisplayAlerts = True On Error GoTo 0 Sheets.Add().Name = "Datasheet" Dim nm As Name Dim i As Long Dim avarSplit As Variant Dim noPage As Variant i = 1 Application.ScreenUpdating = False With Sheets("DataSheet") For Each nm In Names .Cells(1, i) = nm.Name .Cells(2, i) = "'" & nm.RefersTo .Cells(3, i) = nm.Value 'noPage = Split( ????? i = i + 1 Next nm End With Columns("A").Resize(, i).AutoFit End Sub '- ' in workbook module edd: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Call Test End Sub '--   Code to The W

Insert a Chart Built in a Workbook Into Another Workbook

Insert a Chart Built in a Workbook Into Another Workbook Insert into allocated Cells region in a workbook resulted charts built in a different workbook, Can this be done? How would you integrate that chart into some kind of place holder in the workbook that is expecting to get that chart Sub CopyChart() ' Copy Chart 'Chart 1' from ThisWorkbook Worksheet 'Sheet1' ' to Workbook 'BookB.xlsm' Worksheet 'Sheet1', ' at specified position. '-- Dim wbkSource As Workbook ' Source Workbook Dim wksSource As Worksheet ' Source Worksheet ' Top-Left cell where Chart is going to be pasted Dim cSourceTopLeft As Range Dim sTargetTopLeft As String ' Chart Top-Left cell address '-- Dim wbkTarget As Workbook ' Target Workbook Dim wksTarget As Worksheet ' Target Worksheet ' Top-Left cell where Chart is going to be pasted Dim cTargetTopLeft As Range Dim sFil