Solved

Userform, have all side of borders that helps seperate one column with others when information is being insert.

Posted on 2016-09-14
4
40 Views
Last Modified: 2016-09-15
When i use this userform/code for some reason i noticed that the boarders are removed, may someone help me to add a code on this userform so that  when information is about to be input on the actual excel file boarders will be used to cover all side of the row that is being used. Thank you guys for your time and your help.

boarders.pngboarders-2.png
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("GENERAL")

If ActiveCell.EntireRow.Cells(1, 5) <> "" Then Label3.Caption = ActiveCell.EntireRow.Cells(1, 5)
    If ActiveCell.EntireRow.Cells(1, 4) <> "" Then Label4.Caption = ActiveCell.EntireRow.Cells(1, 4)
     If ActiveCell.EntireRow.Cells(1, 6) <> "" Then Label5.Caption = ActiveCell.EntireRow.Cells(1, 6)

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If

'copy the data to the database
        ws.Cells(iRow, 3).Value = "          " & Me.textbox_name.Value
        ws.Cells(iRow, 4).Value = Me.Label4.Caption
        ws.Cells(iRow, 5).Value = Me.Label3.Caption
        ws.Cells(iRow, 6).Value = Me.Label5.Caption
        ws.Cells(iRow, 7).Value = "2"
        


'clear the data
Me.textbox_name.Value = ""
Me.textbox_name.SetFocus
End Sub

Private Sub CommandButton2_Click()
'
' refresh Macro
'

'
    ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort.SortFields. _
        Add Key:=Range("Table134[[#All],[TIMER]]"), SortOn:=xlSortOnValues, Order _
        :=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort.SortFields. _
        Add Key:=Range("Table134[[#All],[TASK]]"), SortOn:=xlSortOnValues, Order _
        :=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort.SortFields. _
        Add Key:=Range("Table134[[#All],[ORGANIZER]]"), SortOn:=xlSortOnValues, _
        Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("GENERAL").ListObjects("Table134").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
Unload Me
End Sub

Open in new window

0
Comment
Question by:Omar Hernandez
  • 3
4 Comments
 
LVL 17

Expert Comment

by:Roy_Cox
ID: 41800125
Is this solved or are you wanting an answer?

If the latter then attach a workbook and state which userform is the problem.
0
 
LVL 17

Accepted Solution

by:
Roy_Cox earned 500 total points
ID: 41800163
Just for free, it is not the code that is changing this borders. It's your choice of Table Design.

Your current selection is highlighted below
Screenshot-2016-09-15-17.43.51.png
Select any cell within the data table, e.g. D71. Look at the Ribbon on the far right, you will see Table Tools and design. Select Design and you will see a choice of preset designs to choose from, some with cell borders. Select one that you like or you can even design your own.
0
 

Author Closing Comment

by:Omar Hernandez
ID: 41800686
How can it be possible that this slip my mind. Thanksss again Roy Cox you are a swell of a guy...
0
 
LVL 17

Expert Comment

by:Roy_Cox
ID: 41800969
Glad to help
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now