ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Please correct my macro (https://www.excelbanter.com/excel-discussion-misc-queries/75327-please-correct-my-macro.html)

famdamly

Please correct my macro
 

My understanding of vb is not very good.


If ActiveCell.Column = t Then ActiveCell.Offset(0, -1).Text = "25"
else ActiveCell.Offset(0, 1).Text = "25"


I have a button between two columns in the center of the screen. I want
the user the to select a cell from one of the two columns, then select
from one of the buttons in between the columns that will assign a value
to the cell on the outside of each column.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519085


Arvi Laanemets

Please correct my macro
 
Hi


If ActiveCell.Column = t Then
ActiveCell.Offset(0, -1).Text = "25"
Else
ActiveCell.Offset(0, 1).Text = "25"
End If

, or
ActiveCell.Offset(0, Iif(ActiveCell.Column = t,-1,1)).Text ="25"


Arvi Laanemets


"famdamly" wrote in
message ...

My understanding of vb is not very good.


If ActiveCell.Column = t Then ActiveCell.Offset(0, -1).Text = "25"
else ActiveCell.Offset(0, 1).Text = "25"


I have a button between two columns in the center of the screen. I want
the user the to select a cell from one of the two columns, then select
from one of the buttons in between the columns that will assign a value
to the cell on the outside of each column.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile:

http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519085




famdamly

Please correct my macro
 

Thanks, I tried each of those and each brings back a run time error 424
object required.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519085


Arvi Laanemets

Please correct my macro
 
Hi

The 't' in your formula is a column label, not a variable? Then

If ActiveCell.Column = 20 Then
ActiveCell.Offset(0, -1).Text = "25"
Else
ActiveCell.Offset(0, 1).Text = "25"
End If

, or
ActiveCell.Offset(0, Iif(ActiveCell.Column = 20,-1,1)).Text ="25"


Arvi Laanemets


"famdamly" wrote in
message ...

Thanks, I tried each of those and each brings back a run time error 424
object required.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile:

http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519085




famdamly

Please correct my macro
 

I kind of thought that might have something to do with it.

Thank you very much for your help.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519085


famdamly

Please correct my macro
 

Darn, it is still not working, same error, and I did have a cell
selected.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519085



All times are GMT +1. The time now is 06:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com