Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Visual Basic Code Needed For Excel

  • Please log in to reply
2 replies to this topic

#1 garnetwr


  • Members
  • 44 posts
  • Local time:09:40 AM

Posted 06 November 2006 - 10:37 AM

I have a spreadsheet with a list of the months in 'Column A' with each month separated by two empty rows
(e.g. December = A1, November = A4, March = A7, etc.)

I need a code that will insert a new row two-rows below the appropriate month [i.e. when compared against the "=NOW()" month]
(e.g. if =NOW() equals 11-06-2006, then I need a blank row inserted at A6)

Anyone assist me with this request?

BC AdBot (Login to Remove)


#2 fozzie


    aut viam inveniam aut faciam

  • Members
  • 3,516 posts
  • Gender:Male
  • Location:Ossendrecht/The Netherlands
  • Local time:03:40 PM

Posted 04 December 2006 - 06:30 PM

Is this matter allready solved?

#3 tos226



  • Members
  • 1,578 posts
  • Gender:Female
  • Location:LocalHost
  • Local time:09:40 AM

Posted 04 December 2006 - 09:20 PM

Probably not. So I'll do some preaching here.

What are you trying to do?
Why blank rows?
Best way to figure out how to do a macro in Excel is to record one and then change recorder references to specific cells by more general code. See help on ranges.
I would start with recording a macro to insert a row, it's a fairly simple one.
Then slowly add the logic for all rows in range, then limit it to "every third" (use MOD() function for that) and do it over a selected range. Date comparison function is trivial, check help, I think it's Month(someDate).

If you're trying to make yourself space for some totals or monthly summaries, perhaps you can avoid the complications by using built-in features such as Subtotals (Data menu).

It's my thing and idiosyncrasy - I violently oppose ANY blank rows or columns in data tables. They make use of Excel next to impossible. If you want it visually pretty - spacing - increase row height instead of carrying blank rows. Continuous ranges just naturally lend themselves to many built-in features which Excel provides. Terrific filtering is just one example.

Oh, make sure to have ALL menu items available, not just the two or three Microsoft thinks you want. I think it's on the Options menu.

Edited by tos226, 04 December 2006 - 09:22 PM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users