Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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
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 Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM
Need Help with interesting Find & Replace macro sirdev Excel Programming 4 July 30th 04 06:32 PM
Screen flashing during macro execution: Interesting observation Juan Pablo González Excel Programming 0 February 1st 04 07:58 PM


All times are GMT +1. The time now is 01:49 AM.

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

About Us

"It's about Microsoft Excel"