Results 1 to 5 of 5

Keep Cell (Row & Column) format unchanged when activating VBA command button

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-07-2020
    Location
    New Zealand
    MS-Off Ver
    365
    Posts
    219

    Keep Cell (Row & Column) format unchanged when activating VBA command button

    Hi There

    I have a VBA code below that I picket up on the site to create a Work Sheet Index, Hyperlink and populate the sheet list on a sheet called "Index"

    The problem I have is, each time I click the command button to update the Sheet "Index" it removes my row coloring, borders and other cosmetic editing features in each cell.

    How can the code be adjusted to only copy the font and not change any formatting in Range A:A


    Sub ListSheets()
     
    Dim ws As Worksheet
    Dim x As Integer
     
    x = 7
     
    Sheets("Index").Range("A:A").Clear
     
    For Each ws In Worksheets
     
       Sheets("Index").Cells(x, 1).Select
       ActiveSheet.Hyperlinks.Add _
       Anchor:=Selection, Address:="", SubAddress:= _
       ws.Name & "!A7", TextToDisplay:=ws.Name
       x = x + 1
     
    Next ws
     
    End Sub
    Last edited by AliGW; 04-10-2020 at 01:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Command Button to format data with subtotals
    By Guestimator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-10-2016, 03:08 PM
  2. [SOLVED] Shape as a button to replace a Command Button which operates conditional format.
    By A440 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2015, 05:46 PM
  3. Command Button on form is activating sheet but not cell
    By GemaDilemma in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2013, 01:18 AM
  4. Create Command Button and format
    By dmeinder in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 10:26 AM
  5. Replies: 8
    Last Post: 07-27-2010, 04:17 PM
  6. Create a command button to format a group of worksheets
    By vjboaz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2008, 09:34 AM
  7. Activating hyperlink with a command button?
    By cstandinguk in forum Excel General
    Replies: 5
    Last Post: 07-28-2007, 01:51 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1