Hello, I have a code like that, which has been using by me, but now I need another one, which won't differ a lot, I hope. Please, analize it, I believe that here I'll find somebody with large luggage of experience. Please, write any suggestions you have. - Sub test()
-
Dim ws As Worksheet, a, i As Long, ii As Long, b(), n As Long, w(), e
-
With CreateObject("Scripting.Dictionary")
-
For Each ws In Worksheets
-
With ws.UsedRange
-
a = .Value
-
.ClearContents
-
End With
-
Redim b(1 To UBound(a, 1) * 2, 1 To UBound(a, 2))
-
For ii = 2 To UBound(a, 2) Step 4
-
For i = 1 To UBound(a, 1)
-
If Not IsEmpty(a(i, ii)) Then
-
If Not .exists(a(i, ii)) Then
-
.Add a(i, ii), Array(a(i, ii - 1), a(i, ii), a(i, ii - 1), a(i, ii))
-
Else
-
w = .Item(a(i, ii)): w(2) = a(i, ii - 1): w(3) = a(i, ii)
-
.Item(a(i, ii)) = w
-
End If
-
End If
-
Next
-
For Each e In .items
-
n = n + 2
-
b(n - 1, ii - 1) = e(0): b(n - 1, ii) = e(1): b(n, ii - 1) = e(2): b(n, ii) = e(3)
-
Next
-
n = 0: .RemoveAll
-
Next
-
ws. Range("a1").Resize(UBound(b, 1), UBound(b, 2)).Value = b
-
n = 0
-
Next
-
End With
-
End Sub
I was using it to delete unnecessary coordinates from two columns, where first column is named 'x' (for arguments) and another one named 'y' for values. I mean I have a diagram, which is described by many coordinates. I need to delete these coordinates, which aren't useful for this diagram, because one straight line in diagram may be described by only two coordinates describing two points. Or I will say it more clearly - every line is described by linear function. Please check third row under title 'Before'. These columns are repeating after every next two empty columns. So after column A&B we should see E&F etc. Program above is used to delete these coordinates, where arguments have increasing values n+1, where n is any positive number expect zero. Values for each arguments repeat a few times, so it would be looking in Excel like that:
Before:
A B
1. 1 1
2. 2 2
3. 3 2
4. 4 2
5. 5 3
6. 6 3
7. 7 3
8. 8 3
9. 9 4
10. 10 4
11. 11 5
12. 12 6
13. 13 6
14. 14 6
15. 15 7
16. 16 7
.. .. ..
After:
A B
1. 1 1
2. 1 1
3. 2 2
4. 4 2
5. 5 3
6. 8 3
7. 9 4
8. 10 4
9. 11 5
10. 11 5
11. 12 6
12. 14 6
13. 15 7
14. 16 7
.. .. ..
But I would use the code for other purpose. I put now a force on two aspects - if there will be only one-column interval between columns with coordinates and another thing - if the scheme will look now inversely - instead X's will be Y's and vice versa, then I will see diagram in horizontal position. But I find a problem, because I don't know how to change the code. Please, help me anybody.
0 1386 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: vcornjamb |
last post by:
Hello, I am developing a web form that contains some buttons and a data grid
which has as its last column link buttons that will delete the data
associated
with that row. Everything works fine, but users have requested a
confirmation
message pop up so the user can confirm the delete. I can not quite get
this to
work. Here are the facts:
I am working in the Microsoft Development Environment 2003 (Version
|
by: Alex |
last post by:
Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params. After I use it, I want to force the deletion of it, so a user cannot hit their refresh button on their browser and trigger the same events that just occurred.
I have tried using Request.Params.Remove("HiddenField"),...
|
by: Karl Richards |
last post by:
I am attempting to delete duplicate rows in a spreadsheet using the Excel object.
Does anyone have any idea how to do this? I've looked everywhere that I can find on the Web and have not been able to find anything on it.
What I have so far is:
Excel.Range range = oSheet.get_Range("A1", Type.Missing);
range = range.get_End(Excel.XlDirection.xlDown);
string downAddress = range.get_Address(false, false, XlReferenceStyle.xlA1,...
|
by: Shelley |
last post by:
Compare Current Year Worksheet with Previous Year Worksheet and if SSN exists in Current Year Worksheet & Not in Previous Year - Copy this Row from Current Year Worksheet & Paste into Previous Year Worksheet
Compare Previous Year Worksheet with Current Year Worksheet and if SSN exists in Previous Year Worksheet & Not in Current Year Worksheet - Delete this Row out of Previous Year Worksheet - THIS IS WHERE I'M HAVING TROUBLE.
This is the...
|
by: David C |
last post by:
I have a GridView with a Delete link and wondered where the best place was
to check and cancel delete of a row/record that is bound to an
SqlDatasource. I can use datasource Deleting event or GridView_RowDeleting
event. I need to get 2 values from the row I am trying to delete so I can
perform another function returns whether I can delete the record or not. I
am trying to do this in gridview event (see code below) but it is not
working....
| |
by: kirubagari |
last post by:
is it possible to do deletion in visual basic.
1.04 FF F2 03 37 04 04 FF - FF 03 37 04 04 FF F0 03.....line 1
2.37 04 04 FF EF 03 37 04 - 04 FF 04 FF EE 03 37 04.....line 2
3.04 FF ED 03 37 04 04 FF - EC 03 37 04 04 FF EB 03....line 3
There is repeating data in the above value.How i can delete the repeating value.When i check it out from byte 49 to mfile size there is repeating data 04 FF.How i can use vb to delete the repetating...
|
by: kirubagari |
last post by:
How about the deletion function.i just modify the insert function to delete function.is it correct.actualy i would like to delete if 04 FF 04 FF (got repeating value) i would like to delete one of the 04 FF.So can i use the function that i modify .The same thing i wana do as insert function but i wana delete this time the condition is if there is repeating value as i mentioned just now.
Public Function DeleteByte(pmArray() As Byte,...
|
by: redskycorp |
last post by:
I have repeating values in my combo box, i do want the values to repeat...any idea how to do that ? The reason is that i am taking the values from my database table "Incomplete" from the "Topic" column....The values repeats it self cause it shows all the values in the column including repeating ones....Anyone know what to do ? I have also included my codings......
Dim data As DAO.Database
Dim rec As DAO.Recordset
Private Sub Form_Load()...
|
by: Claudia d'Amato |
last post by:
I would like to delete the current content/value of the cells
3,6 .... 3,18
How can I do this within a *.vbs script?
Claudia
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |