Hello,
I have this line of code:
This is allowing my code to work, but only in column 1.![]()
Please Login or Register to view this content.
How can I write this line, so that my code apply's to the entire sheet or workbook?
Thank you!
Babs
Hello,
I have this line of code:
This is allowing my code to work, but only in column 1.![]()
Please Login or Register to view this content.
How can I write this line, so that my code apply's to the entire sheet or workbook?
Thank you!
Babs
Delete it.
Surround your VBA code with CODE tags e.g.;
[CODE]your VBA code here[/CODE]
The # button in the forum editor will apply CODE tags around your selected text.
Given the use of Target this is probably part of an Event-code. These Event-codes are restricted to the Sheet of which the Sheetmodule belongs to (where the code is placed).
If you want this code to work for the entire workbook you will have to use an Event-code which is part of ThisWorkbook.
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
Hi Everyone,
I am Ok with it just being the sheet. So, I think I can leave as is.......
But deleting that line and getting rid of the "if" at the End "if" line since I was deleting the first "if" statement.
Now even column 1 doesn't accept the code.
Is there anyway to say instead of
Have it target every column?![]()
Please Login or Register to view this content.
Thanks!
babs
The codes part of another thread......
This works but only in the column it seems to be targeting.
thanks!
![]()
Please Login or Register to view this content.
I figured out something that works:
seems to be working![]()
Please Login or Register to view this content.
thanks!
Babs
Not to step on your achievement, but that If statement doesn't really do anything as it always evaluates as TRUE in the context of your code. It's equivalent to deleting the IF-End If lines.
In your original code I deleted the If Target.Column = 2 Then -End If lines and the code worked for the whole sheet.
Ultimately, this is how I would have written it.
![]()
Please Login or Register to view this content.
Hi AlphaFrog,
Works perfect, and it makes a little more sense to me, as a very very novice code person.
Thank you!!
Babs
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks