Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Arrange description with other options

Posted on 2016-08-30
14
Medium Priority
?
52 Views
Last Modified: 2016-09-01
Hello Experts Exhange community, i am trying to make three other buttons to function with this userform code.

When i click on the userform button ("HOLD" - " ZCOMPLETED" or "AUTO ARRANGE") button make the exixting description on those column replaced with those on button description then search for other row that has the same task with folder name and automatically change those as well.

make the exixting description on those column replaced with those on button description then search for other row that has the same task with folder name and automatically change those as well.
***Change cells with "HOLD --"
***Change cells with "ZCOMPLETED --"
***Change cells with (AUTO ARRANGE #)

Fyi: the actual userform works the only additions will be these three button to have same concept as the actual userform.

images and code with better description is underneath this line, Thanks again Experts Exchange community.

Number-Arange-With-Options.pngNumber-Arange-with-options-2.pngNumber-Arange-with-options-3.pngNumber-Arange-with-options-4.png
Sub openuserform()
NumberArange.Show
End Sub

Private Sub CommandButton1_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption + 1

End Sub

Private Sub CommandButton2_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption - 1
End Sub



Private Sub CommandButton3_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rw As Range
Set ws = Worksheets("GENERAL")

For Each rw In ActiveSheet.UsedRange.Rows
If rw.Cells(1, 5) = Label3.Caption And rw.Cells(1, 4) = Label4.Caption Then
rw.Cells(1, 6) = MyNumber.Caption & Right(rw.Cells(1, 6), Len(rw.Cells(1, 6)) - InStr(ActiveCell.EntireRow.Cells(1, 6), " ") + 1)
End If
Next rw

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
End Sub

Private Sub CommandButton4_Click()
Unload Me
End Sub




Private Sub CommandButton6_Click()

End Sub

Private Sub UserForm_Activate()
If ActiveCell.EntireRow.Cells(1, 6) <> "" Then MyNumber.Caption = Left(ActiveCell.EntireRow.Cells(1, 6), InStr(ActiveCell.EntireRow.Cells(1, 6), " ") - 1)
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)

End Sub

Open in new window

0
Comment
Question by:Omar Hernandez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41777375
Excel file?
0
 

Author Comment

by:Omar Hernandez
ID: 41777381
forgot about this part. Here you go is with this comment.
completed-8-29-22.xlsm
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779265
Sub openuserform()
NumberArange.Show
End Sub

Private Sub CommandButton1_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption + 1

End Sub

Private Sub CommandButton2_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption - 1
End Sub



Private Sub CommandButton3_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rw As Range
Set ws = Worksheets("GENERAL")

For Each rw In ActiveSheet.UsedRange.Rows
If rw.Cells(1, 5) = Label3.Caption And rw.Cells(1, 4) = Label4.Caption Then
rw.Cells(1, 6) = MyNumber.Caption & Right(rw.Cells(1, 6), Len(rw.Cells(1, 6)) - InStr(ActiveCell.EntireRow.Cells(1, 6), " ") + 1)
End If
Next rw

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
End Sub

Private Sub CommandButton4_Click()
Unload Me
End Sub




Private Sub CommandButton5_Click()
Dim rw As Range
Dim mx As Integer
Dim lft As String
mx = 0
For Each rw In ActiveSheet.UsedRange.Rows
If InStr(rw.Cells(1, 6), " ") > 0 Then
lft = Left(rw.Cells(1, 6), InStr(rw.Cells(1, 6), " ") - 1)
If IsNumeric(lft) Then
If Val(lft) > mx Then mx = Val(lft)
End If
End If
Next rw
MyNumber.Caption = mx + 1
End Sub

Private Sub CommandButton6_Click()
    MyNumber.Caption = CommandButton6.Caption
End Sub

Private Sub CommandButton7_Click()
    MyNumber.Caption = CommandButton7.Caption
End Sub

Private Sub MyNumber_Click()

End Sub

Private Sub UserForm_Activate()
If ActiveCell.EntireRow.Cells(1, 6) <> "" Then MyNumber.Caption = Left(ActiveCell.EntireRow.Cells(1, 6), InStr(ActiveCell.EntireRow.Cells(1, 6), " ") - 1)
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)

End Sub

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Omar Hernandez
ID: 41779281
Hello there Saqib, thanks for your response.

The number works perfectly if i am changing numbers to numbers, but when i
***click on a number and try to change it to "HOLD" or "ZCOMPLETED" it gives me a run time error
***Also when i click on Auto arrange if i click on it and the last number was 9 that was assaign to a column, once i delete numbers pertaining to that column and i then go to a task and click on the AUTO ARRANGE button, there not being no numbers it still continue where it last ended and go on from 10 on. Instead of checking for what is the last number in that column and continue from what ever is the last number in that column.
---For example greatest number in that column is 6 if i hit on auto arrange it will show 7.
Back to back example.
---For example greatest number in that column is 3 if i hit on auto arrange it will show 4. and so on

Fyi: if the "--" that pertain to the six column is problematic i would not mind if you have it
 "2"       "HOLD"      "ZCOMPLETED"
instead of having
"2--"      "HOLD --"    "ZCOMPLETED"

error.png
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779294
try
Sub openuserform()
NumberArange.Show
End Sub

Private Sub CommandButton1_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption + 1

End Sub

Private Sub CommandButton2_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption - 1
End Sub



Private Sub CommandButton3_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rw As Range
Set ws = Worksheets("GENERAL")

For Each rw In ActiveSheet.UsedRange.Rows
If rw.Cells(1, 5) = Label3.Caption And rw.Cells(1, 4) = Label4.Caption Then
rw.Cells(1, 6) = MyNumber.Caption & Right(rw.Cells(1, 6), Len(rw.Cells(1, 6)) - InStr(rw.Cells(1, 6), " ") + 1)
End If
Next rw

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
End Sub

Private Sub CommandButton4_Click()
Unload Me
End Sub




Private Sub CommandButton5_Click()
Dim rw As Range
Dim mx As Integer
Dim lft As String
mx = 0
For Each rw In ActiveSheet.UsedRange.Rows
If InStr(rw.Cells(1, 6), " ") > 0 Then
lft = Left(rw.Cells(1, 6), InStr(rw.Cells(1, 6), " ") - 1)
If IsNumeric(lft) Then
If Val(lft) > mx Then mx = Val(lft)
End If
End If
Next rw
MyNumber.Caption = mx + 1
End Sub

Private Sub CommandButton6_Click()
    MyNumber.Caption = CommandButton6.Caption
End Sub

Private Sub CommandButton7_Click()
    MyNumber.Caption = CommandButton7.Caption
End Sub

Private Sub MyNumber_Click()

End Sub

Private Sub UserForm_Activate()
If ActiveCell.EntireRow.Cells(1, 6) <> "" Then MyNumber.Caption = Left(ActiveCell.EntireRow.Cells(1, 6), InStr(ActiveCell.EntireRow.Cells(1, 6), " ") - 1)
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)

End Sub

Open in new window

0
 

Author Comment

by:Omar Hernandez
ID: 41779295
Hey Saqib another inconvenience also pop

Fyi: if it is more helpful for you

add a code where, when those condition are met before applying new description to column "F" erase any words and apply the new informaiton to column "F"

more better understanding what i am saying please check the image below.
moving-from-zcompleted-to-hold.png
moving-from-zcompleted-to-hold-2.png
moving-from-zcompleted-to-hold-then-.png
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779300
First let me know if the last code worked as intended?
0
 

Author Comment

by:Omar Hernandez
ID: 41779302
all other inconvenience are solved the only part that will need a little tweaking is the part of the Auto Arrange button even if there is no number it starts on number 4
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779314
That is because there are hidden rows in the data which contain the number 3
0
 

Author Comment

by:Omar Hernandez
ID: 41779326
I see what your are saying,  when Auto Arrange is click can it exclude all other words that has numbers if it is not under the same name of row column "E" college

For example

on college is 5
on business is 2
on accounting is 4

If i click on auto arrange

on college it will start on 6
on business it will start on 3
on accounting it will start on 5
0
 

Author Comment

by:Omar Hernandez
ID: 41779330
this is what i meant, when Auto Arrange is click can it exclude all other words that has numbers if it is not under the same name of  column "E" college.
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 41779342
This is a new requirement. You would have close this question if this question has been correctly  answered. Then you can ask a new question.
0
 

Author Closing Comment

by:Omar Hernandez
ID: 41779344
Thanks again Saqib i really appreciate the help you provide.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779349
Being pedantic, you should have selected the comment which contains the solution which correctly answers the question.

Anyways thanks for the appreciation. Glad to help.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

715 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