Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interesting macro needed
I need help creating a macro in excel that will fill Cols E - S with th number zero for each row that has text in Col A. something like this: IF there is text in Cell A1 THEN fill Cells E1-S1 with zeros IF there is text in Cell A2 THEN fill Cells E2-S2 with zeros ... Until the Cell in Col A that has no text thank you -- excelbeginne ----------------------------------------------------------------------- excelbeginner's Profile: http://www.excelforum.com/member.php...fo&userid=3222 View this thread: http://www.excelforum.com/showthread.php?threadid=52979 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interesting macro needed
Hi ExcelBeginner,
Try: '================ Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim rng As Range Dim rCell As Range Set WB = Workbooks("MyBook.xls") '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE On Error Resume Next Set rng = Intersect(SH.Columns(1), SH.UsedRange) On Error GoTo 0 If Not rng Is Nothing Then For Each rCell In rng.Cells With rCell If Not IsEmpty(.Value) Then .Offset(0, 4).Resize(1, 15).Value = 0 End If End With Next rCell End If End Sub '<<================ --- Regards, Norman "excelbeginner" wrote in message news:excelbeginner.25rchr_1144184142.461@excelforu m-nospam.com... I need help creating a macro in excel that will fill Cols E - S with the number zero for each row that has text in Col A. something like this: IF there is text in Cell A1 THEN fill Cells E1-S1 with zeros IF there is text in Cell A2 THEN fill Cells E2-S2 with zeros .. Until the Cell in Col A that has no text thank you, -- excelbeginner ------------------------------------------------------------------------ excelbeginner's Profile: http://www.excelforum.com/member.php...o&userid=32228 View this thread: http://www.excelforum.com/showthread...hreadid=529799 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interesting macro needed
Thank you for your reply, I really appreciate it. Based on my user name "Excelbeginner" I have a question. When you indicated Set WB = Workbooks("MyBook.xls") '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE what am I changing and what should I change to? Thank you very much, Excelbeginner -- excelbeginner ------------------------------------------------------------------------ excelbeginner's Profile: http://www.excelforum.com/member.php...o&userid=32228 View this thread: http://www.excelforum.com/showthread...hreadid=529799 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interesting macro needed
Hi ExcelBeginner,
Replace MyBook.xls with the name of your workbook. Replace Sheet1 with the name of your worksheet. --- Regards, Norman "excelbeginner" wrote in message news:excelbeginner.25sssy_1144251904.2817@excelfor um-nospam.com... Thank you for your reply, I really appreciate it. Based on my user name "Excelbeginner" I have a question. When you indicated Set WB = Workbooks("MyBook.xls") '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE what am I changing and what should I change to? Thank you very much, Excelbeginner -- excelbeginner ------------------------------------------------------------------------ excelbeginner's Profile: http://www.excelforum.com/member.php...o&userid=32228 View this thread: http://www.excelforum.com/showthread...hreadid=529799 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Need Help with interesting Find & Replace macro | Excel Programming | |||
Screen flashing during macro execution: Interesting observation | Excel Programming |