I'm try to get the pos. placing in a auto sorted table to remain in place i.e. 1st next to the top position. 2nd next tothe next position and so on down. but it keeps getting it wrong! I've tried amending the macro serval times but it makes things worse! Sorry can't attach the file, too big for this forum!!!!
I have previously used the following code to successfully pull out IE webpage source code for string manipulation.
Its a crude example to demonstrate the principle:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Public IE As Object Sub Sample() Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True
However when I substitute in a Google websites address into the IE.Navigate command, the code runs to the "Source_Code = IE.document ...." line then flags up a Microsoft Visual Basic error. "Run-time error '438': Object doesn't support this property or method"
The webpage that I am trying to access is a confidential company site, so you won't be able to access it yourself, but starts with [URL] ......
The one thing that I have noticed about this website is the Privacy Report icon in the lower right status window (Picture of an eye with a restricted symbol in front). I don't know whether this is the cause of my problem, or purely an incidental observation.
Is there something peculiar with Google sites that means that the source code cannot be extracted in general, or is this an issue specific to my site ? Does the Privacy Report icon have any relevance, and if so how do I switch that off ?
Column 3 is just a ranking from 1-30. So I select all the data in columns 1 and 2 and hit sort from largest to smallest and it looks like excel computes, but nothing changes and it doesn't sort from largest to smallest? A
I have a filter on the Qty column but when I sort Z -A or A - Z it does not work. I have tried formatting as number but no success, I have never seen this before, why the sort wont work? I am using Excel 2010 in Win 7
When I either manually check the box for allowing sorting and autofiltering, or I do it through vba with:
With Sheets("Inventory") .Protect Password:="###", AllowSorting:=True, AllowFiltering:=True, AllowUserInterface:=True .EnableAutoFilter = True End With
I still am unable to use the icons. The icons are clickable to filter or sort, but every time they say that the cells I am selecting are protected. I want them to be protected from editing the data, but want to allow them to be sorted or filtered.
I have entered a custom sort order under 'first key sort order,' but the field is not sorting according to the list.
I'm sure I entered the list correctly, because I actually entered it a long time ago, and it was working for a while. However, today the underlying data was temporarily erased, and the pivot table, when refreshed, basically went blank. I restored the data and refreshed the table, but this field is back to sorting in the wrong order. Refreshing the pivot table and re-choosing the appropriate sort options do not work.
I havet he following code which sorts data. If there is no data to sort I keep on getting a run time error. Could I add something to my code to prevent the run-time error, as sometime there won't be any data to sort. The code runs when I switch to the worksheet in question.
Sub SortMeetings() Dim iCTR As Integer Dim yCTR As Integer Dim zCTR As Integer
zCTR = 11 For iCTR = 12 To 23 For yCTR = 1 To 10 If Len(Range("D" & iCTR).Offset(0, yCTR)) 0 Then Range("AA" & zCTR).Value = Format(Range("D" & iCTR).Offset(0, yCTR), "HH:MM") & " " & Range("D" & iCTR).Value zCTR = zCTR + 1 End If Next yCTR Next iCTR Range("AA11:AA" & zCTR).Select Selection.Sort Key1:=Range("AA11"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End Sub
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Me.Range("E:N")) Is Nothing Then If Range("E34").Value = 0 Then Application.EnableEvents = False Range("G8").Value = Range("G8").Value + 1 If Range("J34").Value = 0 Then Application.EnableEvents = False Range("G9").Value = Range("G9").Value + 1 Application.EnableEvents = True End If End If End If End Sub
Every time I try to add the contents from the request form to the Master CCO tab, the information does not dump. The only way the form will close is if i hit the cancel button. I don't know what I've done wrong with the add request code.
Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If IsNumeric(Target.Value) Then 'Clear the Invalid entry Range("L4").ClearContents Range("L5").ClearContents
If Target.Address = "$K$4" Then Range("K5").ClearContents ElseIf Target.Address = "$K$5" Then Range("K4").ClearContents End If Else Range(Target.Address).ClearContents Target.Next = "Invalid Input" End If..........
However for L28, L29, L48, and L49 the invalid input entry is not showing up properly.
I have made a program using excel vba with userforms, however upon using it on another or any computer with the same version of Office(2007) i am getting a debugging error and highlighting any lines with the words "format" & "date" in the vba code.
Why is the following code not running the macro the number of times I type into the box?
Sub Macro10() 'Sub RunABunch() Dim ans As Variant, i As Long ans = Application.InputBox("Enter a Number of loops", Type:=1) If Not IsNumeric(ans) Then ' user hit cancel, so exit sub Exit Sub End If For i = 1 To CLng(ans) ' do your work here Next i ' Macro10 Macro ' ' Cells.Find(What:="Chief", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate Selection.Cut ActiveCell.Offset(0, 2).Range("A1").Select ActiveSheet.Paste End Sub
I didnt write the loop and input portion of the code, I just recorded the macro and added that bit of code from the net.
In the EXCEL helpfile, there is an example code under HPageBreaks Property:
For Each pb In Worksheets(1).HPageBreaks If pb.Extent = xlPageBreakFull Then cFull = cFull + 1 Else cPartial = cPartial + 1 End If Next MsgBox cFull & " full-screen page breaks, " & cPartial & _ " print-area page breaks"
However, I can't get the code to run. I am consistently getting an error :
Run Time Error "9" : Subscript out of range on very first line of the code. How can one get a subscript out of range with a "For each ... Next" statement ?!!
I cite this as an example, since I am unable to create workable code using HPageBreaks, which I need to...
I'm currently using a vba script to unprotect all of my worksheets within my workbook in order to refresh the pivots and then protect them again once the pivots are completed, but there are two worksheets I would like to remain unprotected in order for users to be able to edit them after the pivots have been refreshed. Now I've tried adding a sub code in order to unprotect one of the sheets as a test to see if it will allow me to edit the worksheet after I update the pivots. Unfortunately the coding isn't working, and the worksheet is still remaining in protect mode. Here's the code I am using to protect the worksheets when refreshing the pivot as well as the code I am attempting to use in order to unprotect the one worksheet.
I have used the below code to make hide/unhide some columns in my excel sheet. It works fine. Now, I need to protrect the sheet except the coloured cells. So I unlocked the cell by clicking the property of the colored cells & then did this :- tools- protection-Protect sheet - protect unlocked cells. But after protecting this sheet the macro code of hiding/unhiding of the columns are NOT WORKING & Errors is coming. I have used the below code:-
What could make this line of code stop working. It has worked for weeks, and just yesterday it stopped working. :x
ActiveWorkbook.Sheets("Email").UsedRange.AutoFilter Field:=2 The sheet is unprotected, and events are enabled. I don't know of anything different than before. What do I look for that would not allow this code to run?
I am trying to a macro that allows me to change the backgroud color and font color depending of the value of the cell.
For example is cell A1 is having the value between 1 to 3 the background color of the cell will the light turqoise, if the value is between 4 to 20 the cell background color will be green and so on.
I have based on certain posted example and adapt to my code but somehow it is not working.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub Select Case Target.Value Case Is = 1, 2, 3 Target.Interior.ColorIndex = 34 Case Is = 4, 5, 10, 20 Target.Interior.ColorIndex = 43 Case Is = 30, 40, 50