Need VBA code , if column C contains any string having length greater than 2 then Column A value has been added by 20 and displays in Column B. this should apply on whole column ie code applies to whole column.
Thanks
Need VBA code , if column C contains any string having length greater than 2 then Column A value has been added by 20 and displays in Column B. this should apply on whole column ie code applies to whole column.
Thanks
Try this:
![]()
Sub RunMe() Dim rCell As Range For Each rCell In Range("C1:C" & Range("C" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeConstants) If Len(rCell) > 2 Then Range("B" & rCell.Row) = Range("A" & rCell.Row) + 20 End If Next rCell End Sub
whats wrong with this code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("C:C")) Is Nothing Then Exit Sub
MsgBox ("Value " & Range("A" & Target.Row).Value)
If Len(Target) > 2 Then
Range("B" & Target.Row).Value = Range("A" & Target.Row).Value + 20
End If
use worksheet_change instead of worksheet_selectionchange
@mubashar ...when posting codes please use code tags around your code
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks