Marco that can replaces the cell value
Closed
lefox
Posts
3
Registration date
Monday April 11, 2011
Status
Member
Last seen
April 11, 2011
-
Apr 11, 2011 at 05:41 AM
lefox - Apr 12, 2011 at 07:00 AM
lefox - Apr 12, 2011 at 07:00 AM
Related:
- Marco that can replaces the cell value
- Clear only the formatting from the selected cell (leaving the content) - Guide
- If cell contains date then return value - Excel Forum
- Based on the value in cells b77 b81 ✓ - Excel Forum
- If cell A1 has text then cell B2 has today's Date ✓ - Excel Forum
- Based on the cell values in cells b77 - Excel Forum
2 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Apr 11, 2011 at 05:48 AM
Apr 11, 2011 at 05:48 AM
Sub test() Dim r As Range, c As Range Set r = Range(Range("A2"), Range("A2").End(xlDown)) For Each c In r If c = "CH" Then c = c.Offset(0, 1) Next c End Sub
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Apr 11, 2011 at 08:26 AM
Apr 11, 2011 at 08:26 AM
it takes the range from A2 down (A1 is heading)
and loops through each cell and checks whether each cells is having an entry "CH" If it is so the macro copies B value to CORRESPONDING cell in column A
otherwise it goes to the next cell in the range without doing anything.
set r=......
this sets the range
for each c in r
looping starts
if c= "CH"....
this is clear (c is cell in A and c.offset(0,1) one column to the right that is B column
next c
this looping technique
when it reaches the last cell in the range r the looping stops
to learn vba you RECORD a macro. The codes for each step will be translated in the subroutine and you can study each code statement.
Perhaps these code statements need some tweaking.
you can also get a good book on vba for your version of excel
and loops through each cell and checks whether each cells is having an entry "CH" If it is so the macro copies B value to CORRESPONDING cell in column A
otherwise it goes to the next cell in the range without doing anything.
set r=......
this sets the range
for each c in r
looping starts
if c= "CH"....
this is clear (c is cell in A and c.offset(0,1) one column to the right that is B column
next c
this looping technique
when it reaches the last cell in the range r the looping stops
to learn vba you RECORD a macro. The codes for each step will be translated in the subroutine and you can study each code statement.
Perhaps these code statements need some tweaking.
you can also get a good book on vba for your version of excel
Apr 11, 2011 at 06:07 AM
Apr 11, 2011 at 06:13 AM