Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8564077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:06:52+00:00 2026-06-11T17:06:52+00:00

I have a script, a very simple script, which is part of a much

  • 0

I have a script, a very simple script, which is part of a much larger script, and right now this last bit is giving me issues and I don’t know why.

This is the part of the script that is giving me problems.

Option Explicit


Sub Test()

    Dim wsJL As Worksheet 'Jobs List
    Dim lastrow As Long    
    Set wsJL = Sheets("Jobs List")

    lastrow = wsJL.Range("B" & Rows.Count).End(xlUp).Row
    wsJL.Range("B3:N3").Copy
    wsJL.Range("B4:N" & lastrow).PasteSpecial xlPasteFormats

End Sub

Here is the workbook.

https://dl.dropbox.com/u/3327208/Excel/format.xlsm

As far as I can tell what I am doing should not be happening. What is happening is it overwrites everything, instead of replacing the format with what was originally copied.

Can someone please attempt to reproduce thisand tell me where my mistake is?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:06:53+00:00Added an answer on June 11, 2026 at 5:06 pm

    You can do the same thing without copying and pasting. It requires a little more code, but doesn’t use the clipboard and doesn’t select anything on your sheet.

    It runs dramatically faster. I’d be curious to know if this works better on your work computer than what you have already tried.

    Try this:

    Sub WriteInsteadOfCopyFormatting()
    
        Dim wsJL As Worksheet 'Jobs List
        Dim rng As Range ' Columns B through N
        Dim dateRng As Range ' Column F
        Dim numbersRng As Range ' Columns J through L
        Dim NCMRRng As Range ' Column M
    
        Dim lastRow As Long
        Dim firstCopyRow As Long
    
        Set wsJL = Sheets("Jobs List")
    
        lastRow = wsJL.Range("B" & Rows.Count).End(xlUp).Row
        firstCopyRow = 4
        Set rng = wsJL.Range("B" & firstCopyRow & ":N" & lastRow)
        Set dateRng = wsJL.Range("F" & firstCopyRow & ":F" & lastRow)
        Set numbersRng = wsJL.Range("J" & firstCopyRow & ":J" & lastRow)
        Set NCMRRng = wsJL.Range("M" & firstCopyRow & ":M" & lastRow)
    
        With rng
            .Interior.Color = 16777215
            .Font.Name = "Calibri"
            .Font.Size = 11
            .Font.Color = vbBlack
            .BorderAround Weight:=xlThin, Color:=vbBlack
        End With
        With rng.Borders(xlInsideVertical)
            .Weight = xlThin
            .Color = vbBlack
        End With
        With rng.Borders(xlInsideHorizontal)
            .Weight = xlThin
            .Color = vbBlack
        End With
    
        dateRng.NumberFormat = "d/mm/yyyy"
        numbersRng.NumberFormat = "#,##0"
        NCMRRng.NumberFormat = "0######"
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this very simple jQuery script, which gives me error that delay is
I have a very simple python script that should scan a text file, which
This is a very simple question. I have a script in the same folder
One of our customers said they have a very simple script which uses fsockopen()
I have a very simple YUI3 script which changes background of a web page.
I have a very simple bit of script that changes the status of an
I have a very simple PHP script which creates favicon.ico form jpg/gif/png uploaded file.
I have this very simple script that allows the user to specify the url
I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I have a very simple script: #!/bin/bash gnuplot << EOF set term postscript portrait

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.