Hi,
I am just starting to learn macros and I wrote one that appends a "-p" to a cell. How can I get this to work on all selected cells?
can someone tell me how I can run the same macro on all selected cells in a column??
Cheers,Sub MarkAsStandAlone() ' ' MarkAsStandAlone Macro ' ' Keyboard Shortcut: Ctrl+Q ' Dim cellvalue As String Dim R As String Dim C As String R = ActiveCell.Row C = ActiveCell.Column cellvalue = ActiveCell.Value ActiveCell = cellvalue & "-i" End Sub
Thanks
How about:
Sub AppendP() Dim c As Object For Each c In Selection c.Value = c.Value & "-p" Next c End Sub
Click the * below to say thanks
Girls sleep with guys who use photoshop, but marry the ones who work with Excel
Corduroy pillows: They're making headlines!
Did you mean: recursion
http://www.google.com/search?hl=en&q=recursion
Works like a charm![]()
Hi Kyle,
I just noticed. I i make a selection in a filtered column then it applies the -p to all the values that are not in the filter as well.. how can we go about doing this?
Option Explicit Sub AppendP() Dim c As Range For Each c In Selection.SpecialCells(xlVisible) c.Value = c.Value & "-p" Next c End Sub
---
Ben Van Johnson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks