# Posts by mikewaller

• ## To locate the cell in which the macro button lies

Re: To locate the cell in which the macro button lies

That's great chaps!
Many, many thanks

• ## To locate the cell in which the macro button lies

Re: To locate the cell in which the macro button lies

Hi Andy

How will it locate the cell that the button is in?

Many thanks
Mike

• ## To locate the cell in which the macro button lies

Re: To locate the cell in which the macro button lies

Thanks.

It works fine but I have got these buttons all over the worksheet. How do I extract the location of the button, without knowing which shape number it is?

Regards
Mike

• ## To locate the cell in which the macro button lies

Hello out there!

I have a problem and where better to turn than the best excel forum in history!!!

Bascially, I have a button on my worksheet that runs a macro when it is pressed. The problem I have is that the macro needs to know excatly where the button is on the worksheet. This is because I have lots of buttons my worksheet and what the macro actually does depends on where the button is!
Hope someone can help....

Regards
Mike

• ## Look up a value in the right hand side of a lookup table

Hi

The following expression looks up the value 5 in a lookup table called 'Figures':

=LOOKUP(5, Figures)

The number 5 is selected from the left hand column in the lookup table and the corresponding value in the right hand column is returned.

However, is it possible to lookup the number 5 in the right hand column of the table and return the value in the left hand column?

Thanks
Mike

• ## If statement dependant on either of two conditions

Re: If statement dependant on either of two conditions

many thanks to you both,
Mike

• ## If statement dependant on either of two conditions

Hello

I've looked in Excel help to find a way to write an IF statement that varies on either of two conditions.

eg.
=IF(A1>1,1,0)

The cell formula above returns a '1' when A1 is greater than 1.
How about returning a '1' if A1 is greater than 1 OR A2 is greater than 1.

I assume it is possible, but I just can't find the solution anywhere.

Thanks to anyone that can help.

Mike

• ## Inverted commas within inverted commas

Re: Inverted commas within inverted commas

Of course!

Thanks Norie. Any idea how I could modify the code to put no value in cell A2 when A1 is zero, rather than returning a zero.

Thanks again
Mike

• ## Inverted commas within inverted commas

Re: Inverted commas within inverted commas

Hi

I'm still stuck with this problem. I've tried recording the action but it is the Cell().Address that I have a problem with.....

The following line of code puts the value of cell B5 in cell A2 when Cell A1 is not empty:

Code
``Cells(2,1).Value = "=IF(RC[-1]="""",0,\$B\$5)"``

However, I would like the B5 cell to be variable.
ie. The value put in cell A2 is the value inside cell(RowNo, 3) where 'RowNo' is a variable.

I've tried to modify the code above to do this but it doesn't work:

Code
``Cells(2,1).Value = "=IF(RC[-1]="""",0," & Cells(RowNo, 3).Address & ")"``

Can anybody see what I'm doing wrong?
Also I would like Cell A2 to be empty when cell A1 is empty, rather than return a zero. This involves using inverted commas again. Is this possible?

Many thanks
Mike

• ## Inverted commas within inverted commas

Hello

I am trying to use inverted commas inside inverted commas as shown below:

Code
``````Cells(2, 10).Value = "8"
Cells(2, 11).Value = "= & "Number " & Cells(2, 10).Value``````

If J2 contains '8' I want cell K2 to display 'Number 8'.
If J2 contains '10' I want cell K2 to display 'Number 10'
etc.

Do you know how I can modify my code to do this?

Mike

• ## Naming a Chart

Re: Naming a Chart

Andy you are a legend!

Thanks!
:thanx:

• ## Naming a Chart

Re: Naming a Chart

Hi Andy

Thanks for your help. I still can't seem to get it to work though. This is my code for creating the chart:

This code puts the chart on the worksheet. I now need to be able to move the chart.

any ideas?

Thanks again
Mike

• ## Naming a Chart

Re: Naming a Chart

Cheers Andy

After naming the chart, I am now trying to move the position of the chart on the worksheet. Do you know how to do this?

Many thanks
Mike

• ## Naming a Chart

Re: Naming a Chart

Hi

Yeah it is naming the chart that I am having trouble with. How do you name a chart?

Thanks
Mike

• ## Naming a Chart

Hi

I have created a chart using VBA but now want to write some code to move the chart around on my worksheet.

The following lines of code will move the chart:

Code
``````ActiveSheet.Shapes(ChartName).ScaleWidth 0.81, msoFalse, msoScaleFromTopLeft
ActiveSheet.Shapes(ChartName).ScaleHeight 1.24, msoFalse, msoScaleFromTopLeft``````

However, VBA seems to recogise the chart as a shape (ie. say shape37). I need to be able to assign that name to my own variable (ChartName) so that I can request for that chart to be moved using the above code.

Any ideas anybody?

Many thanks
Mike

• ## Asking if active sheet is a chart

Re: Asking if active sheet is a chart

Got it working

Thanks chaps

• ## Asking if active sheet is a chart

Re: Asking if active sheet is a chart

Yeah it's definitely it's own sheet. I've even tried creating a new one and testing out the formula. Still doesn't respond.

Does it definitely work on your PC? Maybe it is my version of Excel (I'm currently using Windows 2000 Prof).

Thanks for your help here Dave
Mike

• ## Asking if active sheet is a chart

Re: Asking if active sheet is a chart

Hi Dave

Thanks for the code but it doesn't seem to work. Does this work for XY (Scatter) charts?

Thanks
Mike

• ## Asking if active sheet is a chart

Hi

Does anybody know how to ask if the active sheet is a chart in VBA?

Thanks

Mike

• ## Automatically format a cell with a top border

Re: Automatically format a cell with a top border

Thanks Norie!