#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Macro

hello,
i have data sheet A1:E1000 now i want creat a macro, whenever B coulnm
has = Clear i want let macro run automatically and makes lock that row
A2:E2 like is as under:

A B C D E
Ok Pending Japan 10,500 Abc
Ok Clear Japan 5,000 Bcd

thanks .
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro

Try this:

Sub eqClear()
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Range("$B$2:$B" & lastRow)
If LCase(c) = "clear" Then
c.Offset(0, 1) = Japan
c.Offset(0, 2) = 5000
c.Offset(0, 3) = Bcd
End If
Next
End Sub

"Tufail" wrote:

hello,
i have data sheet A1:E1000 now i want creat a macro, whenever B coulnm
has = Clear i want let macro run automatically and makes lock that row
A2:E2 like is as under:

A B C D E
Ok Pending Japan 10,500 Abc
Ok Clear Japan 5,000 Bcd

thanks .

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Macro

thank you for your posting, but actully what i wanted just B=Clear othe no
need make setting, hope you could understand now.



"JLGWhiz" wrote:

Try this:

Sub eqClear()
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Range("$B$2:$B" & lastRow)
If LCase(c) = "clear" Then
c.Offset(0, 1) = Japan
c.Offset(0, 2) = 5000
c.Offset(0, 3) = Bcd
End If
Next
End Sub

"Tufail" wrote:

hello,
i have data sheet A1:E1000 now i want creat a macro, whenever B coulnm
has = Clear i want let macro run automatically and makes lock that row
A2:E2 like is as under:

A B C D E
Ok Pending Japan 10,500 Abc
Ok Clear Japan 5,000 Bcd

thanks .

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro

Still not sure what you are looking for. This is for worksheet
change and must be pasted in the worksheet code module.
Right click the sheet tab for the sheet that contains your data
and then select view code from the menu. Paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
lr = Cells(Rows.Count, 2).End(xlUp).Row
If Not Intersect(Target, Columns("B")) Is Nothing Then
If LCase(Target.Value) = "clear" Then
Target.Offset(0, 1) = "Japan"
Target.Offset(0, 2) = 5000
Target.Offset(0, 3) = "Bcd"
End If
End If
End Sub

If a user types the word "Clear" into column B, then columns C, D and E
will be populated with the data in that you showed in your posting.

"Tufail" wrote:

thank you for your posting, but actully what i wanted just B=Clear othe no
need make setting, hope you could understand now.



"JLGWhiz" wrote:

Try this:

Sub eqClear()
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Range("$B$2:$B" & lastRow)
If LCase(c) = "clear" Then
c.Offset(0, 1) = Japan
c.Offset(0, 2) = 5000
c.Offset(0, 3) = Bcd
End If
Next
End Sub

"Tufail" wrote:

hello,
i have data sheet A1:E1000 now i want creat a macro, whenever B coulnm
has = Clear i want let macro run automatically and makes lock that row
A2:E2 like is as under:

A B C D E
Ok Pending Japan 10,500 Abc
Ok Clear Japan 5,000 Bcd

thanks .

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"