Hi guys,
I'm a noob in this area but I'm trying to make my daily job easier...
To do so, I created an excel order page with some VLOOKUP and data validation dependent dropdown lists.
I have a mess with internal codes and linking between codes so the purpose of this tool is to always return the correct code and export it to an .xml file for upload in SAP CRM.
Also I have two buttons for data reset in dropdown lists.
All is working nice but two things not working and one partially working.
First is the VBA for reseting second, dependent dropdown list every thime the first one is changed.
I tried with LOOP function but couldn't make it work, so I did it in a Noob's way, just copying the one cell code 54 times
It look's like this:
Problems start when I added Combo box double click VBA in it...
First dropdown list is working, but second, dependent list is not (second one is working with IF and VLOOKUP to find specific code in named range).
Another problem is that two reset buttons are working, but the third is not.
So first is reseting header to "-", second is reseting the named range, the entire table, both with fixed ranges:
I need thirdbutton to reset what is selected in that time, so If I need to reset rows 5,6,7 I want to add a VBA to the button so when I select F6:L12 and click reset, only selected cells go to "-"
Can someone please suggest a code for it as I tried with "Set rng = Selection" and "Set tng = Application.Selection" but with no luck...
The third issue is xml export...
I tried to copy and combine some example code but with no luck.
It creates .xml but not for selection or fixed range (never mind) but the data is wrong as I don't know how...
What I need is a creation of .xml file with two columns of data from selected cells or entire table (fixed, never mind which one is it) after clicking the button.
If you guys can help, It would be a life saver
Thank you all in advance !!!
I'm a noob in this area but I'm trying to make my daily job easier...
To do so, I created an excel order page with some VLOOKUP and data validation dependent dropdown lists.
I have a mess with internal codes and linking between codes so the purpose of this tool is to always return the correct code and export it to an .xml file for upload in SAP CRM.
Also I have two buttons for data reset in dropdown lists.
All is working nice but two things not working and one partially working.
First is the VBA for reseting second, dependent dropdown list every thime the first one is changed.
I tried with LOOP function but couldn't make it work, so I did it in a Noob's way, just copying the one cell code 54 times
It look's like this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("F5").Address Then
Range("G5").Value = "-"
End If
If Target.Address = Range("F6").Address Then
Range("G6").Value = "-"
End If
If Target.Address = Range("F7").Address Then
Range("G7").Value = "-"
First dropdown list is working, but second, dependent list is not (second one is working with IF and VLOOKUP to find specific code in named range).
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Set cboTemp = ws.OLEObjects("TempCombo")
On Error Resume Next
With cboTemp
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
On Error GoTo errHandler
If Target.Validation.Type = 3 Then
Cancel = True
Application.EnableEvents = False
str = Target.Validation.Formula1
str = Right(str, Len(str) - 1)
With cboTemp
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 1
.Height = Target.Height + 1
.ListFillRange = str
.LinkedCell = Target.Address
End With
cboTemp.Activate
Me.TempCombo.DropDown
End If
errHandler:
Application.EnableEvents = True
Exit Sub
End Sub
Private Sub TempCombo_LostFocus()
With Me.TempCombo
.Top = 10
.Left = 10
.Width = 0
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
.Value = ""
End With
End Sub
So first is reseting header to "-", second is reseting the named range, the entire table, both with fixed ranges:
Code:
Private Sub Table_click()
Dim cl As Range
For Each cl In Range("reset_data")
cl = "-"
Next cl
End Sub
Can someone please suggest a code for it as I tried with "Set rng = Selection" and "Set tng = Application.Selection" but with no luck...
The third issue is xml export...
I tried to copy and combine some example code but with no luck.
It creates .xml but not for selection or fixed range (never mind) but the data is wrong as I don't know how...
What I need is a creation of .xml file with two columns of data from selected cells or entire table (fixed, never mind which one is it) after clicking the button.
If you guys can help, It would be a life saver
Thank you all in advance !!!