September 16, 2016, 6:25 am
Hiya,
I'm using an indirect formula in my worksheet to reference information on the relevant sheet, based on the active sheets name.
=(INDIRECT(CONCATENATE("'",LEFT(CELL("filename"),FIND("DRAWING",CELL("filename"))-4),"'!I144")))
This works fine.
I then use a macro to copy and rename the sheet into another workbook, where there is a sheet for it to reference.
For Each sht In Workbooks(TargetFileName).Worksheets
If Left(sht.Name, 7) = "DRAWING" Then
Workbooks(TargetFileName).Sheets(sht.Name).Copy Before:=Workbooks(HostFile).Sheets("Summary")
ActiveSheet.Name = CaseLetter & " - " & sht.Name
ActiveSheet.Range("A1").Select
ActiveSheet.Calculate
End If
Next sht
The cell remains an error.
On hitting F9, or selecting the cell and hitting return, the cell updates and shows the correct figure.
any ideas on how to get the cell to refresh? I've tried quite a few things and none seem to work.
Regards,
Phillip Pitt (I don't know what I'm doing )
↧
September 16, 2016, 5:08 pm
I have a workbook containing a schedule in a linear format arranged with columns corresponding to Outlook fields to allow import into an Outlook calendar.
Because of various institutional inanities, there still needs to be a calendar view of the schedule in excel format for distribution to departments not sharing outlook access.
I lifted this CalendarMaker macro from the internet:
Code:
Sub CalendarMaker()
' Unprotect sheet if had previous calendar to prevent error.
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, _
Scenarios:=False
' Prevent screen flashing while drawing calendar.
Application.ScreenUpdating = False
' Set up error trapping.
On Error GoTo MyErrorTrap
' Clear area a1:g14 including any previous calendar.
Range("a1:g14").Clear
' Use InputBox to get desired month and year and set variable
' MyInput.
MyInput = InputBox("Type in Month and year for Calendar ")
' Allow user to end macro with Cancel in InputBox.
If MyInput = "" Then Exit Sub
' Get the date value of the beginning of inputted month.
StartDay = DateValue(MyInput)
' Check if valid date but not the first of the month
' -- if so, reset StartDay to first day of month.
If Day(StartDay) <> 1 Then
StartDay = DateValue(Month(StartDay) & "/1/" & _
Year(StartDay))
End If
' Prepare cell for Month and Year as fully spelled out.
Range("a1").NumberFormat = "mmmm yyyy"
' Center the Month and Year label across a1:g1 with appropriate
' size, height and bolding.
With Range("a1:g1")
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlCenter
.Font.Size = 18
.Font.Bold = True
.RowHeight = 35
End With
' Prepare a2:g2 for day of week labels with centering, size,
' height and bolding.
With Range("a2:g2")
.ColumnWidth = 11
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = xlHorizontal
.Font.Size = 12
.Font.Bold = True
.RowHeight = 20
End With
' Put days of week in a2:g2.
Range("a2") = "Sunday"
Range("b2") = "Monday"
Range("c2") = "Tuesday"
Range("d2") = "Wednesday"
Range("e2") = "Thursday"
Range("f2") = "Friday"
Range("g2") = "Saturday"
' Prepare a3:g7 for dates with left/top alignment, size, height
' and bolding.
With Range("a3:g8")
.HorizontalAlignment = xlRight
.VerticalAlignment = xlTop
.Font.Size = 18
.Font.Bold = True
.RowHeight = 21
End With
' Put inputted month and year fully spelling out into "a1".
Range("a1").Value = Application.Text(MyInput, "mmmm yyyy")
' Set variable and get which day of the week the month starts.
DayofWeek = Weekday(StartDay)
' Set variables to identify the year and month as separate
' variables.
CurYear = Year(StartDay)
CurMonth = Month(StartDay)
' Set variable and calculate the first day of the next month.
FinalDay = DateSerial(CurYear, CurMonth + 1, 1)
' Place a "1" in cell position of the first day of the chosen
' month based on DayofWeek.
Select Case DayofWeek
Case 1
Range("a3").Value = 1
Case 2
Range("b3").Value = 1
Case 3
Range("c3").Value = 1
Case 4
Range("d3").Value = 1
Case 5
Range("e3").Value = 1
Case 6
Range("f3").Value = 1
Case 7
Range("g3").Value = 1
End Select
' Loop through range a3:g8 incrementing each cell after the "1"
' cell.
For Each cell In Range("a3:g8")
RowCell = cell.Row
ColCell = cell.Column
' Do if "1" is in first column.
If cell.Column = 1 And cell.Row = 3 Then
' Do if current cell is not in 1st column.
ElseIf cell.Column <> 1 Then
If cell.Offset(0, -1).Value >= 1 Then
cell.Value = cell.Offset(0, -1).Value + 1
' Stop when the last day of the month has been
' entered.
If cell.Value > (FinalDay - StartDay) Then
cell.Value = ""
' Exit loop when calendar has correct number of
' days shown.
Exit For
End If
End If
' Do only if current cell is not in Row 3 and is in Column 1.
ElseIf cell.Row > 3 And cell.Column = 1 Then
cell.Value = cell.Offset(-1, 6).Value + 1
' Stop when the last day of the month has been entered.
If cell.Value > (FinalDay - StartDay) Then
cell.Value = ""
' Exit loop when calendar has correct number of days
' shown.
Exit For
End If
End If
Next
' Create Entry cells, format them centered, wrap text, and border
' around days.
For x = 0 To 5
Range("A4").Offset(x * 2, 0).EntireRow.Insert
With Range("A4:G4").Offset(x * 2, 0)
.RowHeight = 65
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.Font.Size = 10
.Font.Bold = False
' Unlock these cells to be able to enter text later after
' sheet is protected.
.Locked = False
End With
' Put border around the block of dates.
With Range("A3").Offset(x * 2, 0).Resize(2, _
7).Borders(xlLeft)
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Range("A3").Offset(x * 2, 0).Resize(2, _
7).Borders(xlRight)
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Range("A3").Offset(x * 2, 0).Resize(2, 7).BorderAround _
Weight:=xlThick, ColorIndex:=xlAutomatic
Next
If Range("A13").Value = "" Then Range("A13").Offset(0, 0) _
.Resize(2, 8).EntireRow.Delete
' Turn off gridlines.
ActiveWindow.DisplayGridlines = False
' Protect sheet to prevent overwriting the dates.
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True
' Resize window to show all of calendar (may have to be adjusted
' for video configuration).
ActiveWindow.WindowState = xlMaximized
ActiveWindow.ScrollRow = 1
' Allow screen to redraw with calendar showing.
Application.ScreenUpdating = True
' Prevent going to error trap unless error found by exiting Sub
' here.
Exit Sub
' Error causes msgbox to indicate the problem, provides new input box,
' and resumes at the line that caused the error.
MyErrorTrap:
MsgBox "You may not have entered your Month and Year correctly." _
& Chr(13) & "Spell the Month correctly" _
& " (or use 3 letter abbreviation)" _
& Chr(13) & "and 4 digits for the Year"
MyInput = InputBox("Type in Month and year for Calendar")
If MyInput = "" Then Exit Sub
Resume
End Sub
I need to map cells in the "Subject" field from the linear schedule to the corresponding day on the calendar view. Weekdays have two shifts and weekends have only one shift, so the rows of my schedule will not relate to dates in a static manner from month to month. I am happy to concatenate both shifts in a single calendar cell, but I just can't figure out how to get started on this. Any help? Thanks in advance.
↧
↧
September 16, 2016, 5:44 pm
So, this may be an easy question, but I'm new at this and trying to learn. I'm creating a basic macro template, where the user can setup a custom text box, and just create as many as they need and have them formatted the same way. My code that works, looks like this:
Code:
Sub TextBox()
Dim shp As Shape
Set shp = ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 75, 175, Range("'Calc'!C2"), Range("'Calc'!C3")) ' add shape
With shp
With .TextFrame.Characters
.Text = Range("N6") ' add text to display.TextAlign = 1
.Font.Name = "Calibre"
.Font.Size = 6
End With
.TextFrame.HorizontalAlignment = xlHAlignCenter
.TextFrame.VerticalAlignment = xlVAlignCenter
.Fill.ForeColor.RGB = RGB(255, 255, 204) 'choose fill color
.Line.Weight = Range("N5") ' adjust width
.Line.ForeColor.RGB = RGB(Range("R28"), Range("S28"), Range("T28")) ' choose color
.Line.DashStyle = msoLineLongDashDot ' choose style
End With
End Sub
Now, what I want to do is, allow them to select the font, the font size, and the outline of the box from a drop down list on the worksheet, so when I try to programmatically refer to a cell for any of these options, it does not work:
Code:
Sub TextBox()
Dim shp As Shape
Set shp = ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 75, 175, Range("'Calc'!C2"), Range("'Calc'!C3")) ' add shape
With shp
With .TextFrame.Characters
.Text = Range("N6") ' add text to display.TextAlign = 1
.Font.Name = Range("N7")
.Font.Size = Range("N8")
End With
.TextFrame.HorizontalAlignment = xlHAlignCenter
.TextFrame.VerticalAlignment = xlVAlignCenter
.Fill.ForeColor.RGB = RGB(255, 255, 204) 'choose fill color
.Line.Weight = Range("N5") ' adjust width
.Line.ForeColor.RGB = RGB(Range("R28"), Range("S28"), Range("T28")) ' choose color
.Line.DashStyle = Range("N9") ' choose style
End With
End Sub
So those values of Font name, font size, and dashstyle, I want the user to be able to select from a dropdown I can put in a worksheet cell. I'm sure this is just syntax, and I'm a noob trying to learn, so if there is anyone out there who can help me with this and take a few seconds to reply, I'd be most grateful.
↧
September 16, 2016, 5:55 pm
Dear experts,
I am having trouble tweaking the code below. I need to paste values and formats to a new workbook (so the one i'm copying from stays intact).
Code:
Sub CombineWorksheets1()
Dim Ws As Worksheet
Application.ScreenUpdating = False
Sheets(1).Select
Worksheets.Add
With Sheets(1)
.UsedRange.Offset(1).Clear
For Each Ws In Worksheets
If .Index <> Ws.Index Then Ws.UsedRange.Offset(1).Copy .Cells(.Rows.Count, 1).End(xlUp)(2)
Application.CutCopyMode = False
Next
Application.GoTo .Cells(1), True
End With
Application.ScreenUpdating = True
End Sub
Ty
↧
September 16, 2016, 6:59 pm
Hi All,
While I have some knowledge in VBA, a solution to this has eluded me.
What I am looking for the Macro to do is match the name in the first worksheet to the name on the second worksheet, then copy the contents under the Data header to the second sheet to the next available cell for the matched name.
I have attached a worksheet to help illustrate what I am looking for. Any questions, please ask.
Thank you for your assistance!
Regards,
NEU
↧
↧
September 16, 2016, 8:06 pm
Hello all,
I am creating some excel tools for project templates. On one of the tools, each sheet (each project) has a number of rows, one row for each action item. A column on each sheet list the due date for each action item, which I have already added conditional formatting to change the row either green, yellow or red the closer the real date gets to the actions due date. What I need to do is add a check box at the end of each row (for each action item) to select if email notification is to be made once the action gets say 5 days away from the due date. I then need another cell in each row to add email address that will be notified when the identified time to due is reached. I would just like a simple email that goes to each address and says something like, "Action item (insert text from action item) is about to go late".
I've been told by our overworked IT department this can be done using VBA so I have purchased a couple of books. I cannot find the time to correctly learn what I need to do. I was hoping the experts could give me some help here. This simple function would really be a huge help and I would greatly appreciate if anyone could help me out.
Thanks
Lance
↧
September 16, 2016, 11:06 pm
Hi all,
I am new to the forums and am having an issue I desperately need help with. I am a junior majoring in chemical engineering and am taking a Process Economics class where we have to use an excel sheet for process costing that came with our book (Analysis, Synthesis, and Design of Chemical Processes by Turton). Long story short, it was created in an old version of Excel for Windows and none of the macros/buttons will run on Excel for Mac 2011. If anyone who is good with VBA (I only have very basic knowledge, i.e. creating a user form, basic coding) could take a look at it and possibly even make it able to run on Mac (or at least tell me that I am screwed and need to run Windows), I would be so eternally grateful. The format is "Excel 97 - 2004 Workbook (.xls)" I have tried saving it as a .xlsm file but it made no difference. The buttons show up as pictures and are unclickable. There are so many modules and user forms I don't even know where to begin. If someone could take a look at it that would be wonderful (I had to attach it as a zip file because it was too large to attach the workbook (1.77 MB). Thanks for reading!
-Kyle
↧
September 16, 2016, 11:32 pm
not to sure why I get this when trying to load my userform, I have checked the spelling and not quite to sure of any other casuses
Code:
Sub Button1_Click()
FindInvoice.Show
End Sub
↧
September 16, 2016, 11:36 pm
I have two sheets namely sheet1(employee) and sheet2(Earnings). In both sheets column A is identical (Empid). I want to delete particular record (i.e empid) using Input box simultaneously in both sheet. The Empid is number.
How to do this?
↧
↧
September 17, 2016, 1:45 am
Hi All
Can anyone please tell me why my TextBox5.Value is being cleared with this code.
Code:
Private Sub CommandButton23_Click()
If UserForm1.TextBox1 = "" Then
MsgBox "PLEASE SELECT A PRODUCT", vbInformation, ""
TextBox1.SetFocus
Exit Sub
End If
Dim Item As String
Dim ws1 As Worksheet
Dim Item2 As String
Dim ws2 As Worksheet
Item = UserForm1.TextBox1
Item2 = UserForm1.TextBox1
Set ws1 = Sheets(UserForm1.TextBox6.Value)
Set ws2 = Sheets("PLU")
'---------------------------------
'Populate Bill--------------------
'---------------------------------
ws1.Select
With ws1
For v = 7 To 20
If ws1.Cells(v, 2) = Item Then
Cells(v, 1).Value = CInt(Cells(v, 1).Value) + CInt(UserForm1.TextBox2.Value)
Cells(v, 4) = Format(Cells(v, 1), "0.00") * Format(TextBox3, "0.00")
Cells(v, 4).NumberFormat = "#,###.00"
GoTo next_sheet
End If
Next
End With
If TextBox2 = "" Then
MsgBox "ENTER A QUANTITY", vbInformation, ""
TextBox2.SetFocus
Exit Sub
End If
With ws1.Range("a4")
.End(xlDown).Offset(1).Resize(, 4) = Array(TextBox2, TextBox1, Format(TextBox3, "0.00"), Format(TextBox2, "0.00") * Format(TextBox3, "0.00"))
.End(xlDown).Offset(1).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
.End(xlDown).Offset(1, 2).NumberFormat = "0.00"
.End(xlDown).Offset(1, 3).NumberFormat = "0.00"
End With
next_sheet:
'---------------------------------
'Populate ListBox-----------------
'---------------------------------
Sheets(UserForm1.TextBox6.Value).Activate
With Sheets(UserForm1.TextBox6.Value)
UserForm1.TextBox4 = Format(Application.WorksheetFunction.VLookup("Sub Total", Range("A7:d50"), 4, False), "0.00")
Dim lastRow As Long, arr, x
lastRow = ws1.Cells(Rows.Count, "A").End(xlUp).Row
arr = ws1.Range("a7:d" & lastRow - 13)
For x = 1 To UBound(arr)
arr(x, 3) = Format(arr(x, 3), ".00")
arr(x, 4) = Format(arr(x, 4), ".00")
Next
With UserForm1.ListBox1
.List = arr
End With
End With
'---------------------------------
'Populate Temp--------------------
'---------------------------------
dlf_bdd = Sheets("Products").Range("a" & Rows.Count).End(xlUp).Row
Set Table = Sheets("Products").Range("A2:U" & dlf_bdd)
Dim wks As Worksheet
Dim tbl As ListObject
Dim RowRef As Long
Set wks = Sheets("Temp")
Set tbl = wks.ListObjects("Table3")
With tbl
.ListRows.Add
RowRef = .ListRows.Count
.DataBodyRange(RowIndex:=RowRef, columnindex:=1).Value = Date
.DataBodyRange(RowIndex:=RowRef, columnindex:=2).Value = Sheets(UserForm1.TextBox6.Value).Range("B2")
.DataBodyRange(RowIndex:=RowRef, columnindex:=3).Value = TextBox5
.DataBodyRange(RowIndex:=RowRef, columnindex:=4).Value = CDbl(TextBox2)
.DataBodyRange(RowIndex:=RowRef, columnindex:=5).Value = TextBox1
.DataBodyRange(RowIndex:=RowRef, columnindex:=8).Value = Format(.DataBodyRange(RowIndex:=RowRef, columnindex:=4).Value * Application.WorksheetFunction.VLookup(.DataBodyRange(RowIndex:=RowRef, columnindex:=5).Value, Table, 8, 0), "0.00")
End With
'--------------------------------
'Printing to sections START
'--------------------------------
If UserForm1.TextBox9 = "BP" Then
With Sheets("BP")
.Range("D2") = Sheets(UserForm1.TextBox6.Value).Range("D2")
.Range("B2") = Sheets(UserForm1.TextBox6.Value).Range("B2")
.Range("A3") = Sheets(UserForm1.TextBox6.Value).Range("A4")
.Range("B3") = Sheets(UserForm1.TextBox6.Value).Range("B4")
With .Range("A3")
.Offset(1, 0) = UserForm1.TextBox2.Value
.Offset(1, 1) = UserForm1.TextBox1
.Offset(1, 2) = UserForm1.TextBox14
.Offset(1, 3) = UserForm1.TextBox15
.Offset(1).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End With
End With
ElseIf UserForm1.TextBox9 = "KP" Then
With Sheets("KP")
.Range("D2") = Sheets(UserForm1.TextBox6.Value).Range("D2")
.Range("B2") = Sheets(UserForm1.TextBox6.Value).Range("B2")
.Range("A3") = Sheets(UserForm1.TextBox6.Value).Range("A4")
.Range("B3") = Sheets(UserForm1.TextBox6.Value).Range("B4")
With .Range("A3")
.Offset(1, 0) = UserForm1.TextBox2.Value
.Offset(1, 1) = UserForm1.TextBox1
.Offset(1, 2) = UserForm1.TextBox14
.Offset(1, 3) = UserForm1.TextBox15
.Offset(1).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End With
End With
ElseIf UserForm1.TextBox9 = "CP" Then
With Sheets("CP")
.Range("D2") = Sheets(UserForm1.TextBox6.Value).Range("D2")
.Range("B2") = Sheets(UserForm1.TextBox6.Value).Range("B2")
.Range("A3") = Sheets(UserForm1.TextBox6.Value).Range("A4")
.Range("B3") = Sheets(UserForm1.TextBox6.Value).Range("B4")
With .Range("A3")
.Offset(1, 0) = UserForm1.TextBox2.Value
.Offset(1, 1) = UserForm1.TextBox1
.Offset(1, 2) = UserForm1.TextBox14
.Offset(1, 3) = UserForm1.TextBox15
.Offset(1).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End With
End With
End If
'---------------------------------
'Populate PLU---------------------
'---------------------------------
ws2.Select
With ws2
For i = 7 To 20
If ws2.Cells(i, 2) = Item2 Then
Cells(i, 3).Value = CInt(Cells(i, 3).Value) + CInt(UserForm1.TextBox2.Value)
Cells(i, 4) = Format(Cells(i, 3), "0.00") * Format(TextBox3, "0.00")
Cells(i, 4).NumberFormat = "#,###.00"
Cells(i, 1).NumberFormat = "#"
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox7 = ""
TextBox11 = ""
TextBox13 = ""
TextBox14 = ""
TextBox15 = ""
Exit Sub
End If
Next
End With
With ws2.Range("A4")
.End(xlDown).Offset(1).Resize(, 4) = Array(Format(TextBox11, "#"), TextBox1, Format(TextBox2, "0.00"), Format(TextBox2, "0.00") * Format(TextBox3, "0.00"))
.End(xlDown).Offset(1).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
.End(xlDown).Offset(1, 3).NumberFormat = "0.00"
.End(xlDown).Offset(1, 4).NumberFormat = "0.00"
.End(xlDown).Offset(1, 1).NumberFormat = "#"
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox7 = ""
'TextBox9 = ""
TextBox11 = ""
TextBox13 = ""
TextBox14 = ""
TextBox15 = ""
End With
End Sub
↧
September 17, 2016, 2:35 am
Hello Team,
Need your help in doing pattern matching. I have data on two sheets.
I have to match a column from two sheets and get the corresponding values when the pattern matches
Sheet 1
Second.PNG and Sheet2
First.PNG
As per the screen shot, I have column called section name on Sheet 1 and Name on Sheet 2.
Example: Name "Agentporta" will be appended by random numbers in the front and back of the name like "sec02552Agenportaportno"
I have compare and if the name matches, I have get the corresponding ticket no from Sheet 2 and paste it into Sheet 1.
I am confused in matching here... please help
↧
September 17, 2016, 2:45 am
Hi,
For some reason the autofill is not completing all rows of the data ranges.
I am using a work book and the range of rows can change once the report is generated and the rows can vary per sheet.
I am using the code:
lngLastRow= ActiveSheet.UsedRange.Rows.Count
Selection.AutoFill Destination:=Range("C2:C" & lnglastrow)
Any advice is much appreciated
↧
September 17, 2016, 2:53 am
Hello,
I am trying to find some code which will allow the date in my spreadsheet to update automatically every time it's opened and a new entry is added. For example, if I bought some eggs for £1 on the 10th September, I would want Excel to enter 10th September automatically in one column when I update the other columns with "eggs" and £1. I am currently using Excel 2010 and I am pretty sure there's some code out there which can do it. I just haven't found it yet. So any suggestions would be most welcome!
Thanks :)
↧
↧
September 17, 2016, 3:01 am
Hi,
I have tried recording a macro to copy and paste values then find and replace values of 00:00:00 with "" throughout the workbook but it doesn't work when I run it.
Any advice would be much appreciated.
Thanks.
↧
September 17, 2016, 5:05 am
I am trying to open a folder that has a fiscal year period.
I have everything that is needed except for the period, for example October month is the 1st fiscal period and September is that last fiscal period (12th).
Here is how my folder path is created:
c:\\financial statement\FY2016\12 Sept 2016\09172016
I can dim the month and the year as as Format(Now, "mmm") and format(Now, "yyyy")
and I can dim the date as Format(Date, "mmddyyyy")
For the fiscal year "FY2016" I have figured out already.
But for the fiscal month period number "12", I cant seem to find in any thread that will convert this month as 12 instead of 9. I did try this:
Format( Now, "mm" + 3) and it gave me a 12 which is good but when October comes, it will change to 13 instead of 01..
Can you someone help with this?
↧
September 17, 2016, 6:22 am
hi
I have seen quite a few threads for highlighting rows using conditional formatting but not many using macros ,I need to look up sheet2 and if column a = column a of sheet 1
then highlight sheet2 rows
colin
↧
September 17, 2016, 12:50 pm
Hey everyone,
New to the forums. i am looking to print different sheets as one. Found many examples on how to do but i would also like to sort column A on all the sheet before printing.
i hope i am making sense.
thanks for all the help.
Sam
↧
↧
September 17, 2016, 1:03 pm
Hi All,
I'm a newbie in Macros and need your help for the below code. Basically i've a workbook with multiple sheets and each sheet is having a combobox list of values. What i want is if a sheet is active then combobox should show a default value related to that sheet only and if another sheet activate then show another default value.
i'm stuck with the below codes..
Code:
Private Sub Worksheet_Activate()
If Worksheets("Ops").active Then
ComboBox1.Value = "Ops & IT (All)"
Else
If Worksheets("CBG").active Then
ComboBox2.Value = "CBG All"
End If
End If
End Sub
thanks
↧
September 17, 2016, 1:56 pm
Hi All,
I am new to VBA and need your help to create a macro that will help to extract deposit amount from different months for each account from a statement. There could be up to 12 months statement for each account and statement can have 1, 2 or up to 5 accounts. Please refer to the attachment for example statement.
Hope this will not be as big as it sounds to me.
Thank you in advance.
vkyjoshi
↧
September 17, 2016, 2:16 pm
Hi Guys,
I have one workbook with two worksheets: Sheet1 that contains the original data, and Sheet2 that would contain the new data after modification.
In my real Sheet1 there are 6 cols and over 6000 rows. Data in ColC is contained within square brackets and needed to be changed in a specific way as follows:
1. Keeping the square brackets
2. Formatting the ColC contents into 3 digits within the square brackets
3. Adding the prefix "MCL1-002-" before the changed contents of the cells
4. Adding a hyphen after the changed content of the cell
5. Finally, adding the statistical occurrence number of the cell content, as all data occurrences are consecutive
Thus, if the original cell content is: [37]
it shall be changed to [MCL1-002-037-1]
and if it is occurring a few times, then the following occurrences in the following cells will be [MCL1-002-037-2], [MCL1-002-037-3], [MCL1-002-037-4], etc.
I am attaching a simple example that illustrates the problem.
Any invaluable input to this issue is deeply appreciated.
Thanks in advance
↧