Solved

Adjustment to display words in the center of the cell.

Posted on 2016-09-27
2
55 Views
Last Modified: 2016-09-28
Hello Expert Exchange helpers and users. I have this code that labels the task with a number, so that it may show me what is the order all the task, i would like to add an additional rule to have it display in the center of the cell when being display.

Sub FindAndPlaceValuesInColumnC()
Dim lr As Long
Dim rng As Range, cell As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
lr = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ActiveSheet.ListObjects("Table134").Range.AutoFilter field:=7, Criteria1:="1"
If Range("G4:G" & lr).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
   Set rng = Range("F5:F" & lr).SpecialCells(xlCellTypeVisible)
   For Each cell In rng
      Cells(cell.Row, "J") = Trim(Replace(cell.Value, "*", ""))
   Next cell
End If
ActiveSheet.ListObjects("Table134").Range.AutoFilter field:=7
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

Open in new window


organize-it.pngorganize-it-2.pngBK-TO-DO-LIST.xlsm
0
Comment
Question by:Omar Hernandez
2 Comments
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 41819344
Find your own line and add 2 lines:

Cells(cell.Row, "J") = Trim(Replace(cell.Value, "*", ""))
Cells(cell.Row, "J").HorizontalAlignment = xlCenter
Cells(cell.Row, "J").VerticalAlignment = xlCenter

Open in new window

0
 

Author Closing Comment

by:Omar Hernandez
ID: 41820976
Thanks a mil Kimputer, works like a charm...
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I comeā€¦
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question