Exclusion is the best policy in preventing bats from gaining entrance into buildings. It isn't always easy, though, because of their size. Bats can squeeze through cracks as narrow as an inch wide. Some of their preferred entrances are in older frame structures where boards are loose or have shrunk. They may also enter houses through loose vents, eaves, spaces around water pipes, electrical outlets, corrugated roofing, doors or windows.
Caulking cracks is most effective if applied during dry weather when cracks are the widest. Weather-stripping—which seals spaces around doors and windows—is also effective in repairing cracks.
If you're certain the noises in your attic are being made by bats, wait for them to leave, then seal the entrances before they return. Unfortunately, you'll need to do the work at night when bats depart for their nightly feeding forays. It's also wise to do this in the fall after the young have learned to fly. Or, wait until winter when many bats have migrated south. Never handle a bat that appears sick or wounded.
Bats can be helpful in your neighborhood because they consume a lot of insects and usually do not pose a health threat to humans.